c++ - Qt: qthread destroyed while thread is still
2015-2-23 · After that wait for the thread to finish properly for some seconds and force it to terminate if it did not finish. So you can have in your destructor : emit setThreadFinished(true); //Tell the thread to finish monitorThread->quit(); if(!monitorThread->wait(3000)) //Wait until it actually has terminated (max. 3 sec) { monitorThread->terminate(); //Thread didn't exit in time, probably deadlocked, terminate it!
Get Price