diff options
author | Gabriel de Dietrich <gabriel.dedietrich@digia.com> | 2013-07-05 16:40:55 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-07-10 09:19:04 +0200 |
commit | c92d1d8acdfb125ce8abfcd996ac151437e6f31d (patch) | |
tree | b270c7221c54cf2e6852db0b5bcc07c24110eacc /src/plugins/platforms/cocoa | |
parent | 2713a4534bc4b26e0d3931385845a2117aef0d3a (diff) |
Cocoa color dialog: Make sure hide() exits the modal session
Change-Id: I708011f3a8ce507e6ade98bf99ad0f5d7b160751
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Diffstat (limited to 'src/plugins/platforms/cocoa')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm index 75a33cbda3..13b4203f7f 100644 --- a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm @@ -295,6 +295,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSColorPanelDelegate); // close down during the cleanup. qApp->processEvents(QEventLoop::ExcludeUserInputEvents | QEventLoop::ExcludeSocketNotifiers); [NSApp runModalForWindow:mColorPanel]; + mDialogIsExecuting = false; return (mResultCode == NSOKButton); } @@ -384,7 +385,13 @@ void QCocoaColorDialogHelper::hide() { if (!mDelegate) return; - [reinterpret_cast<QNSColorPanelDelegate *>(mDelegate)->mColorPanel close]; + QNSColorPanelDelegate *delegate = static_cast<QNSColorPanelDelegate *>(mDelegate); + if (![delegate->mColorPanel isVisible]) + return; + if (delegate->mDialogIsExecuting) + [delegate->mColorPanel performClose:delegate]; + else + [delegate->mColorPanel close]; } void QCocoaColorDialogHelper::setCurrentColor(const QColor &color) |