summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@nokia.com>2009-11-12 09:56:07 (GMT)
committerRichard Moe Gustavsen <richard.gustavsen@nokia.com>2009-11-12 10:49:27 (GMT)
commit639b9c0286f0f2d5e50121df8d4125f029074510 (patch)
tree01cc6a0f3ef5e0fb1a7a665527b7c7109b889211
parentc785d92153d23b836451b0643424b9871bcc4be9 (diff)
downloadQt-639b9c0286f0f2d5e50121df8d4125f029074510.zip
Qt-639b9c0286f0f2d5e50121df8d4125f029074510.tar.gz
Qt-639b9c0286f0f2d5e50121df8d4125f029074510.tar.bz2
Cocoa: QColorDialog makes the application hang
The reason is that the color dialog is using a native dialog. And this dialog enters modality on its own, bypassing the modality mechanism in Qt. Most important, when the dialog leaves modality, it does so by calling [NSApp stopModal]. And this call stops all modal sessions in the application, including the ones owned by Qt. This patch detects when this situation occurs, and makes sure that all modal sessions gets stopped the correct way, and later rebuilt. Rev-By: MortenS
-rw-r--r--src/gui/kernel/qeventdispatcher_mac.mm6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/gui/kernel/qeventdispatcher_mac.mm b/src/gui/kernel/qeventdispatcher_mac.mm
index c9dd949..427f0b0 100644
--- a/src/gui/kernel/qeventdispatcher_mac.mm
+++ b/src/gui/kernel/qeventdispatcher_mac.mm
@@ -571,6 +571,12 @@ bool QEventDispatcherMac::processEvents(QEventLoop::ProcessEventsFlags flags)
QBoolBlocker execGuard(d->currentExecIsNSAppRun, false);
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
+ // 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();
+ }
} else {
d->nsAppRunCalledByQt = true;
QBoolBlocker execGuard(d->currentExecIsNSAppRun, true);