summaryrefslogtreecommitdiffstats
path: root/src/libs/installer/remoteclient_p.h
diff options
context:
space:
mode:
authorkh1 <karsten.heimrich@digia.com>2014-06-03 15:35:37 +0200
committerKarsten Heimrich <karsten.heimrich@digia.com>2014-06-03 15:48:08 +0200
commite07968ebb99b7fe4e67c0470ec486a92816036d5 (patch)
treead7e3bf5d95cae2ca57de0b745060f7276c72259 /src/libs/installer/remoteclient_p.h
parent22fb61b60c0686795f9671789ab3393da6c22987 (diff)
We need to pass the socket to the connect function.
The keep alive thread does try to delete the socket it gets from the connect method, but since the socket was created in a different thread and we will hit the: "Socket notifiers cannot be disabled from another thread" warning. Change-Id: Ibafcd67f8cdb51b365c3ef230f1ebd447bdd306a Reviewed-by: Niels Weber <niels.weber@digia.com>
Diffstat (limited to 'src/libs/installer/remoteclient_p.h')
-rw-r--r--src/libs/installer/remoteclient_p.h17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/libs/installer/remoteclient_p.h b/src/libs/installer/remoteclient_p.h
index 5f7dc0bea..ed47d0d53 100644
--- a/src/libs/installer/remoteclient_p.h
+++ b/src/libs/installer/remoteclient_p.h
@@ -90,7 +90,8 @@ private slots:
{
// Try to connect to the server. If we succeed the server side running watchdog gets
// restarted and the server keeps running for another 30 seconds.
- QScopedPointer<QTcpSocket> socket(m_client->connect());
+ QTcpSocket socket;
+ m_client->connect(&socket);
}
m_timer->start(1000);
@@ -134,9 +135,9 @@ public:
if (m_mode == RemoteClient::Release) {
QObject *const object = new KeepAliveObject(q_ptr);
object->moveToThread(&m_thread);
+ QObject::connect(&m_thread, SIGNAL(started()), object, SLOT(run()));
QObject::connect(&m_thread, SIGNAL(finished()), object, SLOT(deleteLater()));
m_thread.start();
- QTimer::singleShot(0, object, SLOT(run()));
} else if (mode == RemoteClient::Debug) {
m_active = true;
m_serverStarted = true;
@@ -188,8 +189,8 @@ public:
// 30 seconds ought to be enough for the app to start
while (m_serverStarting && m_serverStarted && t.elapsed() < 30000) {
Q_Q(RemoteClient);
- QScopedPointer<QTcpSocket> socket(q->connect());
- if (socket)
+ QTcpSocket socket;
+ if (q->connect(&socket))
m_serverStarting = false;
}
}
@@ -206,13 +207,13 @@ public:
return;
Q_Q(RemoteClient);
- QScopedPointer<QTcpSocket> socket(q->connect());
- if (socket) {
- QDataStream stream(socket.data());
+ QTcpSocket socket;
+ if (q->connect(&socket)) {
+ QDataStream stream(&socket);
stream << QString::fromLatin1(Protocol::Authorize);
stream << m_key;
stream << QString::fromLatin1(Protocol::Shutdown);
- socket->flush();
+ socket.flush();
}
m_serverStarted = false;
}