summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@nokia.com>2009-11-14 09:59:35 (GMT)
committerRichard Moe Gustavsen <richard.gustavsen@nokia.com>2009-11-23 14:16:44 (GMT)
commit896d4a4d5c9f9dc3831a23b81d39ff00e6f6d33f (patch)
treeb72c1b36be9f846672667dcbab8529dddd4d8b2d /src
parent20594620667864c48745254abb54dbce442aa6f4 (diff)
downloadQt-896d4a4d5c9f9dc3831a23b81d39ff00e6f6d33f.zip
Qt-896d4a4d5c9f9dc3831a23b81d39ff00e6f6d33f.tar.gz
Qt-896d4a4d5c9f9dc3831a23b81d39ff00e6f6d33f.tar.bz2
Cocoa: native dialogs might hang the application on close
This patch implements the same fix as 639b9c0286f0f2d5e50121df8d4125f029074510, but when someone spins the event dispatcher manually (calling processEvents themselves). Rev-By: MortenS
Diffstat (limited to 'src')
-rw-r--r--src/gui/kernel/qeventdispatcher_mac.mm10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/gui/kernel/qeventdispatcher_mac.mm b/src/gui/kernel/qeventdispatcher_mac.mm
index 427f0b0..e0eebfd 100644
--- a/src/gui/kernel/qeventdispatcher_mac.mm
+++ b/src/gui/kernel/qeventdispatcher_mac.mm
@@ -572,7 +572,7 @@ bool QEventDispatcherMac::processEvents(QEventLoop::ProcessEventsFlags flags)
while (!d->interrupt && [NSApp runModalSession:session] == NSRunContinuesResponse)
qt_mac_waitForMoreModalSessionEvents();
if (!d->interrupt && session == d->currentModalSessionCached) {
- // Someone called e.g. [NSApp stopModal:] from outside the event
+ // INVARIANT: Someone called e.g. [NSApp stopModal:] from outside the event
// dispatcher (e.g to stop a native dialog). But that call wrongly stopped
// 'session' as well. As a result, we need to restart all internal sessions:
d->temporarilyStopAllModalSessions();
@@ -596,7 +596,13 @@ bool QEventDispatcherMac::processEvents(QEventLoop::ProcessEventsFlags flags)
if (NSModalSession session = d->currentModalSession()) {
if (flags & QEventLoop::WaitForMoreEvents)
qt_mac_waitForMoreModalSessionEvents();
- [NSApp runModalSession:session];
+ NSInteger status = [NSApp runModalSession:session];
+ if (status != NSRunContinuesResponse && session == d->currentModalSessionCached) {
+ // INVARIANT: Someone called e.g. [NSApp stopModal:] from outside the event
+ // dispatcher (e.g to stop a native dialog). But that call wrongly stopped
+ // 'session' as well. As a result, we need to restart all internal sessions:
+ d->temporarilyStopAllModalSessions();
+ }
retVal = true;
break;
} else {