diff options
| author | Thomas Vanbesien <tvanbesi@proton.me> | 2026-03-09 11:16:56 +0100 |
|---|---|---|
| committer | Thomas Vanbesien <tvanbesi@proton.me> | 2026-03-09 11:16:56 +0100 |
| commit | 47096b375797c38b5b1e79f1366f1152cc292875 (patch) | |
| tree | 6f7a63760d776d8b9ea5a84988992555b60befa2 | |
| parent | e35f8dd0deca155353f7e0ba2477ec6eda764acb (diff) | |
| download | BobinkQtOpcUa-47096b375797c38b5b1e79f1366f1152cc292875.tar.gz BobinkQtOpcUa-47096b375797c38b5b1e79f1366f1152cc292875.zip | |
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.
| -rw-r--r-- | src/OpcUaClient.cpp | 13 |
1 files 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); } |
