diff options
-rw-r--r-- | src/client/vnc/vncthread.cpp | 2 | ||||
-rw-r--r-- | src/client/vnc/vncwindow.cpp | 12 | ||||
-rw-r--r-- | src/client/vnc/vncwindow.h | 1 |
3 files changed, 12 insertions, 3 deletions
diff --git a/src/client/vnc/vncthread.cpp b/src/client/vnc/vncthread.cpp index b710a2c..cafdace 100644 --- a/src/client/vnc/vncthread.cpp +++ b/src/client/vnc/vncthread.cpp @@ -202,8 +202,6 @@ void VncThread::run() while (_run) this->msleep(100); qDebug("[%s] VNC client stopped.", metaObject()->className()); - this->deleteLater(); - QThread::run(); } /** diff --git a/src/client/vnc/vncwindow.cpp b/src/client/vnc/vncwindow.cpp index 0854f01..c9c0d93 100644 --- a/src/client/vnc/vncwindow.cpp +++ b/src/client/vnc/vncwindow.cpp @@ -49,7 +49,10 @@ void VncWindow::terminateVncThread() if (_vncWorker == NULL) return; - _vncWorker->blockSignals(true); + disconnect(_vncWorker, SIGNAL(projectionStopped()), this, SLOT(onProjectionStopped())); + disconnect(_vncWorker, SIGNAL(projectionStarted()), this, SLOT(onProjectionStarted())); + disconnect(_vncWorker, SIGNAL(imageUpdated(const int, const int, const int, const int)), this, + SLOT(onUpdateImage(const int, const int, const int, const int))); _vncWorker->stop(); _vncWorker = NULL; if (_redrawTimer != 0) { @@ -62,6 +65,12 @@ void VncWindow::terminateVncThread() } } +void VncWindow::deleteVncThread() +{ + qDebug() << "Deleting thread" << QObject::sender(); + delete QObject::sender(); +} + /** * Draws given part of the current VNC frame buffer to the window. * Gets the image from the _vncWorker thread in an unsafe way. :( @@ -106,6 +115,7 @@ void VncWindow::open(const QString& host, int port, const QString& passwd, bool connect(_vncWorker, SIGNAL(imageUpdated(const int, const int, const int, const int)), this, SLOT(onUpdateImage(const int, const int, const int, const int)), Qt::QueuedConnection); + connect(_vncWorker, SIGNAL(finished()), this, SLOT(deleteVncThread()), Qt::QueuedConnection); setWindowTitle(caption); diff --git a/src/client/vnc/vncwindow.h b/src/client/vnc/vncwindow.h index 3247b12..277339c 100644 --- a/src/client/vnc/vncwindow.h +++ b/src/client/vnc/vncwindow.h @@ -32,6 +32,7 @@ protected slots: void onProjectionStarted(); void onProjectionStopped(); void timer_moveToTop(); + void deleteVncThread(); void open(const QString& host, int port, const QString& passwd, bool ro, bool fullscreen, const QString& caption, const int clientId, const QByteArray& rawThumb); // bool close(); |