Stop QThread properly

Posted on 02 Jan, 2015 in qt

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,


this will solve the problem for sure.