From c92d1d8acdfb125ce8abfcd996ac151437e6f31d Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Fri, 5 Jul 2013 16:40:55 +0200 Subject: Cocoa color dialog: Make sure hide() exits the modal session Change-Id: I708011f3a8ce507e6ade98bf99ad0f5d7b160751 Reviewed-by: Shawn Rutledge --- src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/plugins/platforms/cocoa') 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(mDelegate)->mColorPanel close]; + QNSColorPanelDelegate *delegate = static_cast(mDelegate); + if (![delegate->mColorPanel isVisible]) + return; + if (delegate->mDialogIsExecuting) + [delegate->mColorPanel performClose:delegate]; + else + [delegate->mColorPanel close]; } void QCocoaColorDialogHelper::setCurrentColor(const QColor &color) -- cgit v1.2.3