Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
5.15.2, 6.2.3, 6.3
-
None
Description
See attached example. We start a dialog and while it is running two other event loops are started. Each of these should be finished about 1.5s after being started. We quit the application after 20 seconds. The behavior is as expected on Windows, but on Mac an event loop gets stuck and it does not exit before the application is quit. (Can also be triggered by closing both windows).
Example output:
1.553 start loop: QEventLoop(0x7ffeefbfbf00)
2.652 start loop: QEventLoop(0x7ffeefbfa1e0)
3.130 timeout; loop: QEventLoop(0x7ffeefbfbf00)
4.228 timeout; loop: QEventLoop(0x7ffeefbfa1e0)
4.229 finished loop: QEventLoop(0x7ffeefbfa1e0)
20.268 finished loop: QEventLoop(0x7ffeefbfbf00)
It can be seen that the timeout works fine, but one of the eventloop fails to quit (0x7ffeefbfbf00).
An improvement (if not a complete solution) could be to do the following in
bool QCocoaEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags)
(patch made for 5.15.2)
--- qt-everywhere-src-5.15.2/qtbase/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm.orig 2022-01-17 11:33:08.000000000 +0100 +++ qt-everywhere-src-5.15.2/qtbase/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm 2022-01-17 13:49:25.000000000 +0100 @@ -409,6 +409,8 @@ QBoolBlocker execGuard(d->currentExecIsNSAppRun, false); while ([NSApp runModalSession:session] == NSModalResponseContinue && !d->interrupt) { qt_mac_waitForMoreEvents(NSModalPanelRunLoopMode); + if (d->interrupt) + d->propagateInterrupt = true; if (session != d->currentModalSessionCached) { // It's possible to release the current modal session // while we are in this loop, for example, by closing all
Attachments
Issue Links
- relates to
-
QTBUG-105357 EventLoop does not quit properly
- Closed