diff options
author | Richard Moe Gustavsen <richard.gustavsen@nokia.com> | 2010-08-26 09:10:02 (GMT) |
---|---|---|
committer | Richard Moe Gustavsen <richard.gustavsen@nokia.com> | 2010-08-26 09:23:37 (GMT) |
commit | a373648fa876a9684394aa9b7ecafd51e53f4742 (patch) | |
tree | 5a4aae1efb5b8b35d928d6365d7effd33ee0f154 | |
parent | bce4c42a3d0c7d24009230e09aa58db60db39d40 (diff) | |
download | Qt-a373648fa876a9684394aa9b7ecafd51e53f4742.zip Qt-a373648fa876a9684394aa9b7ecafd51e53f4742.tar.gz Qt-a373648fa876a9684394aa9b7ecafd51e53f4742.tar.bz2 |
Cocoa: Demo browser can get stuck after closing modal dialog
This turns out to be a glitch in the event dispatcher for Qt/Cocoa.
The problem is that you can, in some really slim cases it must be, end up
calling processEvents with the exec flag set, while the current modal
dialog has been told to leave modal. In that case, we recurse into
a new event dispatching loop for a session that is about to die. And
that causes problems when the session actually dies. This patch makes
sure that you cannon start spinning a session that is about to die, by
setting the sessionCache to zero.
Task-number: QTBUG-13164
Reviewed-by: Tor Arne
-rw-r--r-- | src/gui/kernel/qeventdispatcher_mac.mm | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/gui/kernel/qeventdispatcher_mac.mm b/src/gui/kernel/qeventdispatcher_mac.mm index 89f01d8..515c6d3 100644 --- a/src/gui/kernel/qeventdispatcher_mac.mm +++ b/src/gui/kernel/qeventdispatcher_mac.mm @@ -830,6 +830,7 @@ NSModalSession QEventDispatcherMacPrivate::currentModalSession() [window setLevel:levelBeforeEnterModal]; } currentModalSessionCached = info.session; + cleanupModalSessionsNeeded = false; } return currentModalSessionCached; } @@ -881,6 +882,10 @@ void QEventDispatcherMacPrivate::cleanupModalSessions() for (int i=stackSize-1; i>=0; --i) { QCocoaModalSessionInfo &info = cocoaModalSessionStack[i]; if (info.widget) { + // This session has a widget, and is therefore not marked + // as stopped. So just make it current. There might still be other + // stopped sessions on the stack, but those will be stopped on + // a later "cleanup" call. currentModalSessionCached = info.session; break; } @@ -926,6 +931,7 @@ void QEventDispatcherMacPrivate::endModalSession(QWidget *widget) if (i == stackSize-1) { // The top sessions ended. Interrupt the event dispatcher // to start spinning the correct session immidiatly: + currentModalSessionCached = 0; cleanupModalSessionsNeeded = true; QEventDispatcherMac::instance()->interrupt(); } |