Details
-
Bug
-
Resolution: Fixed
-
P3: Somewhat important
-
6.6.2
-
None
-
b4642eda1e2481822f9a77f02208d4ba77202cc3, 5f8089693 (tqtc/dev), 9bec8a7ef (tqtc/6.6), e2580959d (tqtc/dev), d97ca0f9f (tqtc/6.5), f44feadc6 (tqtc/6.6), e138c01bd (tqtc/dev), 62123a34f (tqtc/6.6), 557731e5c (tqtc/6.5), 625f3c693 (tqtc/dev)
Description
See https://doc.qt.io/qtforpython-6/examples/example_opcua_opcuaviewer.html
Problem 1: Undefined variable
Traceback (most recent call last): File "D:\QtSupport\opcuaviewer\mainwindow.py", line 142, in findServers self.createClient() File "D:\QtSupport\opcuaviewer\mainwindow.py", line 115, in createClient QMessageBox.critical(self, "Failed to connect to server", message) NameError: name 'message' is not defined Traceback (most recent call last): File "D:\QtSupport\opcuaviewer\mainwindow.py", line 142, in findServers self.createClient() File "D:\QtSupport\opcuaviewer\mainwindow.py", line 115, in createClient QMessageBox.critical(self, "Failed to connect to server", message) NameError: name 'message' is not defined
Original C++ code
void MainWindow::createClient() { if (mOpcUaClient == nullptr) { mOpcUaClient = mOpcUaProvider->createClient(ui->opcUaPlugin->currentText()); if (!mOpcUaClient) { const QString message(tr("Connecting to the given sever failed. See the log for details.")); log(message, QString(), Qt::red); QMessageBox::critical(this, tr("Failed to connect to server"), message); return; } // ... } }
Python code
def createClient(self): if not self._opcua_client: self._opcua_client = self.mOpcUaProvider.createClient(self._ui.opcUaPlugin.currentText()) if not self._opcua_client: qWarning("Connecting to the given server failed. See the log for details.") QMessageBox.critical(self, "Failed to connect to server", message) return # ...
Problem 2: Crash
Steps to reproduce
- Fix the undefined variable above
- Ensure that OpenSSL is available in the PATH (required to load the "open62541" plugin)
- Run the example and click "Find servers"
The program will soon crash, regardless of whether or not an OPC UA server is running on the local machine.
Note: The C++ version of the example doesn't crash using Qt 6.6.2: It fails gracefully when no server is available, and connects successfully to the server when it is available.
Attachments
Issue Links
- relates to
-
QTBUG-91388 OpcUa: Invalid read in message handler thread when running the viewer example
-
- Closed
-