C++ QThread and connect causing crashes
C++ QThread and connect causing crashes My QThread counter crashes giving odd results for what the number should be as the Thread counts properly but in the SetLabel function I get a different number to whats in the QThread ands it then crashes after 3 seconds and the label doesnt seem to update. QThread* CountThread = new QThread; Counter* Count = new Counter(); Count->moveToThread(CountThread); connect(CountThread, SIGNAL(started()), Count, SLOT(Process())); connect(Count, &Counter::SecondsUpdate, this, [=]{ SetLabel(Count->Seconds) ;}); connect(Count, SIGNAL(finished()), CountThread, SLOT(quit())); CountThread->start(); void Counter::Process() { int secs = 0; while (secs < 1000) { qDebug() << "hello" << secs; secs += 1; Sleep(1000); emit SecondsUpdate(); } emit finished(); } void BaseWindow::SetLabel(int Seconds) { qDebug() << Seconds; this->Test->setText(QString("Seconds: " + QString::number(Seconds))); } c...