diff options
| -rw-r--r-- | tests/auto/core/ifcodegen/backends/cmdlistener/cmdlistener.cpp | 7 | ||||
| -rw-r--r-- | tests/auto/core/ifcodegen/backends/cmdlistener/cmdlistener.h | 4 |
2 files changed, 10 insertions, 1 deletions
diff --git a/tests/auto/core/ifcodegen/backends/cmdlistener/cmdlistener.cpp b/tests/auto/core/ifcodegen/backends/cmdlistener/cmdlistener.cpp index 4cc2db7d..2110a606 100644 --- a/tests/auto/core/ifcodegen/backends/cmdlistener/cmdlistener.cpp +++ b/tests/auto/core/ifcodegen/backends/cmdlistener/cmdlistener.cpp @@ -16,9 +16,14 @@ CmdListener::CmdListener(QObject *parent) emit newCmd(cmd); } }); - connect(socket, &QLocalSocket::disconnected, [socket]() { + m_reconnectingConnection = connect(socket, &QLocalSocket::disconnected, [socket]() { socket->connectToServer("qifcmdsocket"); }); } +CmdListener::~CmdListener() +{ + disconnect(m_reconnectingConnection); +} + #include "moc_cmdlistener.cpp" diff --git a/tests/auto/core/ifcodegen/backends/cmdlistener/cmdlistener.h b/tests/auto/core/ifcodegen/backends/cmdlistener/cmdlistener.h index ef0de9c7..4a535ad7 100644 --- a/tests/auto/core/ifcodegen/backends/cmdlistener/cmdlistener.h +++ b/tests/auto/core/ifcodegen/backends/cmdlistener/cmdlistener.h @@ -15,9 +15,13 @@ class CMDLISTENER_EXPORT CmdListener : public QObject public: explicit CmdListener(QObject *parent = nullptr); + virtual ~CmdListener() override; Q_SIGNALS: void newCmd(const QString &cmd); + +private: + QMetaObject::Connection m_reconnectingConnection; }; #endif // CMDLISTENER_H |
