Hello,
I've got QThread sub-classed with run() re-implemented thus:
void Logger::run()
{
timer->setInterval(updateIntervalSeconds*1000);
connect(timer, SIGNAL(timeout()), this, SLOT(doJob()));
timer->start();
exec();
timer->stop();
delete timer;
return;
}
void Logger::run()
{
QTimer* timer = new QTimer();
timer->setInterval(updateIntervalSeconds*1000);
connect(timer, SIGNAL(timeout()), this, SLOT(doJob()));
timer->start();
exec();
timer->stop();
delete timer;
return;
}
To copy to clipboard, switch view to plain text mode
where doJob() is a func that contains stuff to be done. The doJob() func gets called as excpected but when ending the thread I get a crash that points to the timer->stop(). Commenting that out the crash points at the delete timer; commenting that out, the crash points to run()s end brace.
I get a Qt message QThread object destroyed while thread is still running, but I call the quit() func before deleting the object. what's going on?
thanks
K
Bookmarks