dimanche 19 avril 2015

Qt Application still running after closing MainWindow

I'm trying to implement a multithreaded app that displays video using the OpenCV libraries (following the example given here).


I create two threads from the GUI thread that successfully terminate when the MainWindow is closed. However, the program still keeps on running (I have to use the stop button on the application output panel to close it down).


Here's my destructor for the MainWindow



MainWindow::~MainWindow()
{

captureThread.quit();
converterThread.quit();

if (captureThread.wait())
qDebug() << "Capture Thread has exited successfully";

if (converterThread.wait())
qDebug() << "Converter Thread has exited successfully";

delete ui;
}


The Application Output window returns the following output on both the Debug and Release builds



Capture Thread has exited successfully
Converter Thread has exited successfully


However, the application only quits in Debug mode.


From what I have gathered from a few google searches is that the application continues on running IF there is a thread that has not been properly terminated. Can that be the case here? If yes, then how may I know which other thread is also running in the program, so that I may terminate/quit it?


Using Qt 5.4 with MSVC 2013 and OpenCV 3.0 beta on Win 8.1


PS I even added captureThread.terminate() and converterThread.terminate() in the destructor but still the results are the same.


Aucun commentaire:

Enregistrer un commentaire