summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qeventdispatcher_mac.mm
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/kernel/qeventdispatcher_mac.mm')
-rw-r--r--src/gui/kernel/qeventdispatcher_mac.mm12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/gui/kernel/qeventdispatcher_mac.mm b/src/gui/kernel/qeventdispatcher_mac.mm
index 427f0b0a15..eda75db40b 100644
--- a/src/gui/kernel/qeventdispatcher_mac.mm
+++ b/src/gui/kernel/qeventdispatcher_mac.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -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 {