Skip to content

Fix PySide6.8 signal-slot threading problem

Kien Le requested to merge bug-#293-pyside6.8_threading_causes_crash into develop

Closes #293 (closed)

PySide6.8 includes a rewrite of the signal-thread code. One of the side-effects is that the thread affinity (i.e. the thread a slot runs in) of a function slot is changed. Before, a function slot defaults to running in the main thread. In 6.8, a function slots run in the thread in which the signal that invoked it lives. This causes some code which relied on the old behavior to break.

This MR fixes the problem by creating a wrapper class for the problematic function. All instances of the wrapper class are automatically moved to the main thread on creation. Then, whenever the old threading behavior needs to be used, we use the wrapper class instead of using the function directly. Because the function is called from an object in the main thread in this case, it will always run in the main thread, which fixes our problem.

Edited by Kien Le

Merge request reports

Loading