-
Bug
-
Resolution: Out of scope
-
Not Evaluated
-
None
-
6.8.0
-
None
I looked at PYSIDE-3124, but this appears to be a separate issue since all the receivers here are @Slot-decorated methods.
I have attached a small example, where a signal from an object in the GUI thread is sent over to a worker object in a separate thread, and another signal is sent from the worker back to a third object the GUI thread.
If the receiving object is a derived class, where it and the base class both decorate their method with @Slot, the thread affinity is disregarded, and the method is called from the wrong thread. If the @Slot decorator is removed from the base class method definition, the derived class functions as expected.
Output with
USE_DERIVED = False
Python 3.10.2 win32
Qt 6.8.0 (x86_64-little_endian-llp64 shared (dynamic) release build; by MSVC 2022) [Python limited API 3.10.2]
gui_thread=<PySide6.QtCore.QThread(0x213449ef360, name = "Qt mainThread") at 0x000002134667E740>
other_thread=<PySide6.QtCore.QThread(0x21344a184f0) at 0x000002134667E7C0>
echo test: <PySide6.QtCore.QThread(0x21344a184f0) at 0x000002134667E7C0>
rx test
with
USE_DERIVED = True
Python 3.10.2 win32 Qt 6.8.0 (x86_64-little_endian-llp64 shared (dynamic) release build; by MSVC 2022) [Python limited API 3.10.2] gui_thread=<PySide6.QtCore.QThread(0x22c83b24250, name = "Qt mainThread") at 0x0000022C857FE740> other_thread=<PySide6.QtCore.QThread(0x22c83b4e7f0) at 0x0000022C857FE7C0> echo test: <PySide6.QtCore.QThread(0x22c83b4e7f0) at 0x0000022C857FE7C0> rx test modified QObject: Cannot create children for a parent that is in a different thread. (Parent is DerivedReceiverObject(0x22c83b4e0b0), parent's thread is QThread(0x22c83b24250), current thread is QThread(0x22c83b4e7f0)
- relates to
-
PYSIDE-3124 Signal handlers run in wrong thread in Python 6.8 and 6.9.
-
- Closed
-