From e8b54c512720f4b5fd4490f429c020323cd38904 Mon Sep 17 00:00:00 2001 From: sr Date: Tue, 5 Feb 2013 19:11:10 +0100 Subject: ... --- src/server/mainwindow/mainwindow.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'src/server/mainwindow/mainwindow.cpp') diff --git a/src/server/mainwindow/mainwindow.cpp b/src/server/mainwindow/mainwindow.cpp index 9e89baa..0441f1d 100644 --- a/src/server/mainwindow/mainwindow.cpp +++ b/src/server/mainwindow/mainwindow.cpp @@ -353,6 +353,17 @@ void MainWindow::onButtonChat() */ } +bool MainWindow::isValidClient(Client* client) +{ + for (QList::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it) + { + Client *c = (**it).client(); + if (c == client) + return true; + } + return false; +} + void MainWindow::prepareForProjection(Client * const from, Client * const to) { // Projection source is never allowed to be an active VNC viewer @@ -576,7 +587,6 @@ void MainWindow::onClientConnected(Client* client) qDebug("ListenServer told MainWindow about new connection"); connect(client, SIGNAL(authenticating(Client*, ClientLogin*)), this, SLOT(onClientAuthenticating(Client*, ClientLogin*))); connect(client, SIGNAL(authenticated(Client*)), this, SLOT(onClientAuthenticated(Client*))); - connect(client, SIGNAL(vncClientStateChange(Client*)), this, SLOT(onVncClientStateChange(Client*))); } void MainWindow::onClientAuthenticating(Client* client, ClientLogin* request) @@ -619,7 +629,8 @@ void MainWindow::onClientAuthenticating(Client* client, ClientLogin* request) void MainWindow::onClientAuthenticated(Client* client) { disconnect(client, SIGNAL(authenticated(Client*)), this, SLOT(onClientAuthenticated(Client*))); - connect(client, SIGNAL(vncServerStateChange(Client*)), this, SLOT(onVncServerStateChange(Client*))); + connect(client, SIGNAL(vncServerStateChange(Client*)), this, SLOT(onVncServerStateChange(Client*)), Qt::QueuedConnection); + connect(client, SIGNAL(vncClientStateChange(Client*)), this, SLOT(onVncClientStateChange(Client*)), Qt::QueuedConnection); bool hasActiveTutor = false; ConnectionFrame *deadTutor = NULL; bool anyClient = false; @@ -711,6 +722,8 @@ void MainWindow::onClientAuthenticated(Client* client) void MainWindow::onVncServerStateChange(Client* client) { + if (!isValidClient(client)) // Check here because this slot is connected queued + return; if (client->vncPort() > 0) { // VNC Server started on some client - start projection on all clients interested in that client's screen @@ -763,6 +776,8 @@ void MainWindow::onVncServerStateChange(Client* client) void MainWindow::onVncClientStateChange(Client* client) { + if (!isValidClient(client)) // Check here because this slot is connected queued + return; // If the client started projection, ignore event. Also if // the source is not known (anymore), we cannot do anything meaningful here if (client->isActiveVncClient() || client->currentProjectionSource() == 0) -- cgit v1.2.3-55-g7522