Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
None
-
6.4.0
-
None
-
Linux, windows
-
-
d106f5811c (pyside/pyside-setup/dev) 52e493335d (pyside/pyside-setup/6.4) 52e493335d (pyside/tqtc-pyside-setup/6.4) d106f5811c (pyside/tqtc-pyside-setup/dev) d106f5811c (pyside/tqtc-pyside-setup/tqtc/dev) 52e493335d (pyside/pyside-setup/6.4.1)
Description
The following python program leads to a deadlock since pyside 6.4.0:
import threading from sys import argv from threading import Thread from PySide6.QtCore import QMetaObject from PySide6.QtCore import Qt from PySide6.QtCore import Slot from PySide6.QtWidgets import QApplication from PySide6.QtWidgets import QLabel from PySide6.QtWidgets import QMainWindow class Window(QMainWindow): def __init__(self): super().__init__() print(f"__init__: {threading.current_thread().name}") self.__statusLabel = QLabel() self.statusBar().addWidget(self.__statusLabel) @Slot() def setText(self): print(f"setText: {threading.current_thread().name}") self.__statusLabel.setText("Status") def setStatus(self): print(f"setStatus: {threading.current_thread().name}") QMetaObject.invokeMethod(self, "setText", Qt.ConnectionType.BlockingQueuedConnection) def asynch(window): print(f"asynch: {threading.current_thread().name}") window.setStatus() app = QApplication(argv) window = Window() Thread(target=asynch, args=[window], daemon=True).start() window.show() app.exec()
While asynch() and setStatus() are called on a new Thread-1, setText() should be called on the MainThread.
This worked fine with Pyside6 6.3.1:
$ python asyncapp.py __init__: MainThread asynch: Thread-1 (asynch) setStatus: Thread-1 (asynch) setText: MainThread
With Pyside6 6.4.0 I have a deadlock:
$ python asyncapp.py __init__: MainThread asynch: Thread-1 (asynch) setStatus: Thread-1 (asynch)
Attachments
Issue Links
- resulted from
-
PYSIDE-1898 QMetaObject.invokeMethod with arguments not possible
- Closed