diff options
author | Gabriel de Dietrich <gabriel.dedietrich@digia.com> | 2013-04-12 15:25:38 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-04-15 13:17:26 +0200 |
commit | 61b71b2baf10c8dc4fbff5fd4e8c7a7d325a8ee2 (patch) | |
tree | e50953890474ab89dd4a47526b6d2af4ae2ac216 /src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm | |
parent | b64c9a89da539280a947e34458a738bf3e19ff7c (diff) |
Cocoa: Fix unresponsive main window after running more than one modal session
For some reason, we postpone clearing the stack of modal sessions until we call
processPostedEvents() again. However, it also means that when we clear the second
modal session, that session keeps running although we just closed its window. The
reason why it isn't stopped is because it wasn't the topmost modal session in the
stack.
This patch fixes the issue by stopping a modal session if any session above in the
stack has been stopped. This makes it less problematic if we don't call
processPostedEvents() in between ending modal sessions.
Task-number: QTBUG-30504
Change-Id: I9f898250ae629947d066647f9d5a0b9f75cf0070
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm index 5c487b0bdd..2ac9a5dac9 100644 --- a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm +++ b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm @@ -741,11 +741,14 @@ void QCocoaEventDispatcherPrivate::endModalSession(QWindow *window) // when we stop the _current_ modal session (which is the session on top of // the stack, and might not belong to 'window'). int stackSize = cocoaModalSessionStack.size(); + int endedSessions = 0; for (int i=stackSize-1; i>=0; --i) { QCocoaModalSessionInfo &info = cocoaModalSessionStack[i]; + if (!info.window) + endedSessions++; if (info.window == window) { info.window = 0; - if (i == stackSize-1) { + if (i + endedSessions == stackSize-1) { // The top sessions ended. Interrupt the event dispatcher to // start spinning the correct session immediately. Like in // beginModalSession(), we call interrupt() before clearing |