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
-
For Gerrit Dashboard: PYSIDE-2635 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
546744,4 | OpcUa Viewer Example: Fix flake8-warnings and port to f-strings | tqtc/dev | pyside/tqtc-pyside-setup | Status: MERGED | +2 | 0 |
546745,10 | OpcUa Viewer Example: Fix crash scanning for servers | tqtc/dev | pyside/tqtc-pyside-setup | Status: MERGED | +2 | 0 |
546837,7 | Add M2M example documentation | tqtc/dev | pyside/tqtc-pyside-setup | Status: MERGED | +2 | 0 |
546921,3 | OpcUa Viewer Example: Fix flake8-warnings and port to f-strings | tqtc/6.6 | pyside/tqtc-pyside-setup | Status: MERGED | +2 | 0 |
546944,2 | OpcUa Viewer Example: Fix flake8-warnings and port to f-strings | tqtc/6.5 | pyside/tqtc-pyside-setup | Status: MERGED | +2 | 0 |
546968,2 | Add M2M example documentation | tqtc/6.6 | pyside/tqtc-pyside-setup | Status: MERGED | +2 | 0 |
547078,2 | OpcUa Viewer Example: Fix crash scanning for servers | tqtc/6.5 | pyside/tqtc-pyside-setup | Status: MERGED | +2 | 0 |
547079,2 | OpcUa Viewer Example: Fix crash scanning for servers | tqtc/6.6 | pyside/tqtc-pyside-setup | Status: MERGED | +2 | 0 |
550245,3 | OpcUa Viewer Example: Handle missing function in message log context | tqtc/dev | pyside/tqtc-pyside-setup | Status: MERGED | +2 | 0 |
550275,2 | OpcUa Viewer Example: Handle missing function in message log context | tqtc/6.7 | pyside/tqtc-pyside-setup | Status: MERGED | +2 | 0 |
550276,2 | OpcUa Viewer Example: Handle missing function in message log context | tqtc/6.6 | pyside/tqtc-pyside-setup | Status: MERGED | +2 | 0 |
550277,2 | OpcUa Viewer Example: Handle missing function in message log context | tqtc/6.5 | pyside/tqtc-pyside-setup | Status: MERGED | +2 | 0 |