Md. Minhazul Haque
Minhaz's Blog

Minhaz's Blog

Stop QThread properly

Stop QThread properly

Md. Minhazul Haque's photo
Md. Minhazul Haque
·Jan 2, 2015·

1 min read

Are you annoyed with this message? When you try to terminate a thread while quitting the main application thread, and this weird message appears after the applications is closed?

QThread: Destroyed while thread is still running

Try adding QThread::wait() before quitting the application. For example,

thread->terminate();
thread->wait();
qApp->quit();

this will solve the problem for sure.

 
Share this