Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.9.4
-
None
-
-
197029b3d23237e61311019de1b63e3ce6720ed5 (qt/qtbase/5.12)
Description
Suppose you started a local run of a QEventLoop in some thread:
// thread1
QEventLoop loop;
loop.exec();
and you want to exit it from a different thread like this:
// thread2 gets a reference to the loop variable somehow
loopFromThread1.exit(0);
then the loop does not always exit.
The issue seems to be caused by the fact that the interrupt variable in QEventDispatcherWin32Private is a normal bool and not an atomic.
The change of the Boolean to false by the interrupt() call by QEventLoop::exit() is not always seen by the thread running the loop.
The same member has been turned into a QAtomicInt in QEventDispatcherUNIXPrivate by the following commit:
Ieffaa169eb67f40dc935291b3994f9ff1c7e05f0
https://codereview.qt-project.org/#/c/51060/