macOS: Clean up modal sessions after each pass of processEvents()

The Qt macOS event dispatcher defers modal session cleanup until
the next runloop pass. But as it stood, we never did do so for
stand-alone qApp->processEvents() calls. The result was
that a NSModalSession would be kept alive longer than necessary, which
would impact the activation state of other QWindows.

Change-Id: I054f3084132c9d20a29a3f5823c19b7123ef40bf
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
This commit is contained in:
Richard Moe Gustavsen 2020-06-24 15:13:06 +02:00 committed by Tor Arne Vestbø
parent 33714b6c02
commit 040a7cfa93

View File

@ -504,6 +504,11 @@ bool QCocoaEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags)
retVal = true; retVal = true;
} }
} }
// Clean up the modal session list, call endModalSession.
if (d->cleanupModalSessionsNeeded)
d->cleanupModalSessions();
} while (!d->interrupt && event); } while (!d->interrupt && event);
if ((d->processEventsFlags & QEventLoop::EventLoopExec) == 0) { if ((d->processEventsFlags & QEventLoop::EventLoopExec) == 0) {