diff options
author | Ulf Hermann <[email protected]> | 2017-09-07 13:17:32 +0200 |
---|---|---|
committer | Ulf Hermann <[email protected]> | 2017-09-07 12:58:12 +0000 |
commit | 239ed56f4b719179278b1983e635f8ccc32f2eb9 (patch) | |
tree | cb5d56e2b23f4387466824ccac7acfcbc168d674 /src/libs/qmldebug/qmldebugclient.cpp | |
parent | 3ccbaff2da1d59a6143cbbaf27f86bfbcda1cf75 (diff) |
QmlDebug: Decouple QmlDebugConnection and QmlDebugClient
The protected methods of QmlDebugClient need to be called by
QmlDebugConnection already. We also want to call them directly for
testing, so we make them public rather than having QmlDebugConnection
be a friend. By using a QPointer, we can avoid resetting the connection
on each client when it is deleted.
Change-Id: I2c0e3d2b8ec19e9acbc6b8f5623b4c28caae319a
Reviewed-by: hjk <[email protected]>
Diffstat (limited to 'src/libs/qmldebug/qmldebugclient.cpp')
-rw-r--r-- | src/libs/qmldebug/qmldebugclient.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/libs/qmldebug/qmldebugclient.cpp b/src/libs/qmldebug/qmldebugclient.cpp index 597281ab258..5935fee5d25 100644 --- a/src/libs/qmldebug/qmldebugclient.cpp +++ b/src/libs/qmldebug/qmldebugclient.cpp @@ -33,6 +33,8 @@ #include <qlocalserver.h> #include <qlocalsocket.h> +#include <QPointer> + namespace QmlDebug { const int protocolVersion = 1; @@ -46,7 +48,7 @@ public: QmlDebugClientPrivate(); QString name; - QmlDebugConnection *connection; + QPointer<QmlDebugConnection> connection; }; class QmlDebugConnectionPrivate @@ -263,11 +265,7 @@ QmlDebugConnection::QmlDebugConnection(QObject *parent) QmlDebugConnection::~QmlDebugConnection() { - Q_D(QmlDebugConnection); socketDisconnected(); - QHash<QString, QmlDebugClient*>::iterator iter = d->plugins.begin(); - for (; iter != d->plugins.end(); ++iter) - iter.value()->d_func()->connection = 0; } bool QmlDebugConnection::isConnected() const @@ -435,7 +433,6 @@ QAbstractSocket::SocketState QmlDebugConnection::socketState() const } QmlDebugClientPrivate::QmlDebugClientPrivate() - : connection(0) { } |