#include "vanitygenplus.h" #include "ui_vanitygenplus.h" #include #include #include "util.h" #include #if QT_VERSION >= 0x050000 #include #else #include #endif #include "vanitygen.h" //for vanitygen(argc, argv); VanitygenPlus *uii=NULL; Ui::VanitygenPlus *uiii=NULL; char *argv[] = {"vanitygen", "-X", "23", "ANGEL", NULL}; int argc = sizeof(argv) / sizeof(char*) - 1; VanitygenPlus::VanitygenPlus(QWidget *parent) : QWidget(parent), ui(new Ui::VanitygenPlus) { ui->setupUi(this); connect(ui->pushButtonCoinControl, SIGNAL(clicked()), this, SLOT(vanitygenButtonClicked())); uiii = ui; uii = this; } VanitygenPlus::~VanitygenPlus() { delete ui; uii = NULL; } void VanitygenPlus::vanitygenButtonClicked() { ui->plaintextbox_QPlainTextEdit->appendPlainText("bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"); //IS OK!!! vanitygen(argc, argv); //This extern fuction/library will call "printf2" below with new stdout string } int __cdecl printf2(const char *format, ...) { //NOTE: //The using of variable uiii->plaintextbox_QPlainTextEdit in this function will crash immediately all program //but right before crash will set anyway the new text in it despite of?!?!?! va_list argptr; va_start(argptr, format); char buf[1024]; int ret = vsnprintf(buf, sizeof(buf), format, argptr); QString temp=QString::fromLatin1(buf); //uiii->plaintextbox_QPlainTextEdit->insertPlainText(temp); //->WILL RISE THE CRASH!!! //uii->findChild("plaintextbox_QPlainTextEdit")->insertPlainText(temp); //->WILL RISE THE CRASH!!! va_end(argptr); return ret; }