From 47096b375797c38b5b1e79f1366f1152cc292875 Mon Sep 17 00:00:00 2001 From: Thomas Vanbesien Date: Mon, 9 Mar 2026 11:16:56 +0100 Subject: Fix auto-accept certificate blocking for 30s on event loop timeout When acceptCertificate() was called synchronously from the certificateTrustRequested signal handler, m_certLoop was still nullptr so the quit() call was a no-op. The event loop then blocked for the full 30-second timeout. Skip the event loop when m_certAccepted is already set by a synchronous handler. --- src/OpcUaClient.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/OpcUaClient.cpp b/src/OpcUaClient.cpp index 91ce47b..a319f29 100644 --- a/src/OpcUaClient.cpp +++ b/src/OpcUaClient.cpp @@ -305,11 +305,14 @@ OpcUaClient::handleConnectError (QOpcUaErrorState *errorState) emit certificateTrustRequested ( QStringLiteral ("The server certificate is not trusted. Accept?")); - QEventLoop loop; - m_certLoop = &loop; - QTimer::singleShot (30000, &loop, &QEventLoop::quit); - loop.exec (); - m_certLoop = nullptr; + if (!m_certAccepted) + { + QEventLoop loop; + m_certLoop = &loop; + QTimer::singleShot (30000, &loop, &QEventLoop::quit); + loop.exec (); + m_certLoop = nullptr; + } errorState->setIgnoreError (m_certAccepted); } -- cgit v1.2.3