summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJannis Voelker <jannis.voelker@basyskom.com>2024-01-23 13:01:55 +0100
committerJannis Völker <jannis.voelker@basyskom.com>2024-01-30 10:20:48 +0000
commitfe3bfc5eeea7ed95e73837e0dbdc9f63f13d5c46 (patch)
tree5444bd5c692fa20f65859cef6348e780c1a47d58
parent11587d035293cef05ba1b945ab18835a1190af89 (diff)
Fix segfault during connect test shutdown
This change ensures that all asynchronous backend activity is stopped before the destructor returns. Change-Id: I16d34027e41e5658a771ae099c9a7b027d765e86 Pick-to: 6.7 6.6 Reviewed-by: Frank Meerkoetter <frank.meerkoetter@basyskom.com>
-rw-r--r--src/plugins/opcua/open62541/qopen62541client.cpp2
-rw-r--r--tests/auto/connection/tst_connection.cpp9
2 files changed, 11 insertions, 0 deletions
diff --git a/src/plugins/opcua/open62541/qopen62541client.cpp b/src/plugins/opcua/open62541/qopen62541client.cpp
index f2861c0..6a626c6 100644
--- a/src/plugins/opcua/open62541/qopen62541client.cpp
+++ b/src/plugins/opcua/open62541/qopen62541client.cpp
@@ -57,6 +57,8 @@ QOpen62541Client::~QOpen62541Client()
{
if (m_thread->isRunning())
m_thread->quit();
+
+ m_thread->wait();
}
void QOpen62541Client::connectToEndpoint(const QOpcUaEndpointDescription &endpoint)
diff --git a/tests/auto/connection/tst_connection.cpp b/tests/auto/connection/tst_connection.cpp
index 347a7ec..5131331 100644
--- a/tests/auto/connection/tst_connection.cpp
+++ b/tests/auto/connection/tst_connection.cpp
@@ -29,6 +29,7 @@ class Tst_Connection: public QObject
public:
Tst_Connection();
+ ~Tst_Connection();
private slots:
void initTestCase();
@@ -58,6 +59,11 @@ Tst_Connection::Tst_Connection()
m_backends = QOpcUaProvider::availableBackends();
}
+Tst_Connection::~Tst_Connection()
+{
+ qDeleteAll(m_clients);
+}
+
void Tst_Connection::initTestCase()
{
const quint16 defaultPort = 43344;
@@ -209,6 +215,9 @@ void Tst_Connection::cleanupTestCase()
m_serverProcess.kill();
m_serverProcess.waitForFinished(2000);
}
+
+ qDeleteAll(m_clients);
+ m_clients.clear();
}
int main(int argc, char *argv[])