summaryrefslogtreecommitdiffstats
path: root/src/server/mainwindow/mainwindow.cpp
diff options
context:
space:
mode:
authorsr2013-02-05 19:11:10 +0100
committersr2013-02-05 19:11:10 +0100
commite8b54c512720f4b5fd4490f429c020323cd38904 (patch)
treef9ea255f2bc8064cfa08220f0e9911376029a65d /src/server/mainwindow/mainwindow.cpp
parent[SERVER/CLIENT] Wait for connection to close properly before deleting socket ... (diff)
downloadpvs2-e8b54c512720f4b5fd4490f429c020323cd38904.tar.gz
pvs2-e8b54c512720f4b5fd4490f429c020323cd38904.tar.xz
pvs2-e8b54c512720f4b5fd4490f429c020323cd38904.zip
...
Diffstat (limited to 'src/server/mainwindow/mainwindow.cpp')
-rw-r--r--src/server/mainwindow/mainwindow.cpp19
1 files changed, 17 insertions, 2 deletions
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<ConnectionFrame*>::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)