Fix segfault with onlinepollerthread
[irwi] / src / selectremotedlg.cpp
index ec435c6..8b1085e 100644 (file)
@@ -18,6 +18,7 @@
 SelectRemoteDlg::SelectRemoteDlg(QWidget *parent)
     : QDialog(parent)
 {
+    onlinePollerThread = NULL;
     this->setWindowTitle(tr("Select remote"));
     this->setMinimumHeight(320);
 
@@ -55,7 +56,8 @@ SelectRemoteDlg::~SelectRemoteDlg()
 {
     delete layout;
     if (onlinePollerThread != NULL) {
-        onlinePollerThread->quit();
+        onlinePollerThread->stop();
+        onlinePollerThread->wait();
         delete onlinePollerThread;
         onlinePollerThread = NULL;
     }
@@ -117,7 +119,8 @@ void SelectRemoteDlg::downloadRemote()
 void SelectRemoteDlg::getDB()
 {
     if (onlinePollerThread != NULL) {
-        onlinePollerThread->quit();
+        onlinePollerThread->stop();
+        onlinePollerThread->wait();
         delete onlinePollerThread;
         onlinePollerThread = NULL;
     }