From 639b9c0286f0f2d5e50121df8d4125f029074510 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Thu, 12 Nov 2009 10:56:07 +0100 Subject: 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 --- src/gui/kernel/qeventdispatcher_mac.mm | 6 ++++++ 1 file changed, 6 insertions(+) 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); -- cgit v0.12