diff options
author | Teemu Katajisto <teemu.katajisto@digia.com> | 2012-11-29 12:46:23 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-12-01 08:29:33 +0100 |
commit | 5dbcd9dfea9785befdbe051b926f1d4e4ad0980a (patch) | |
tree | 370a3b39e56c16dbecc7612ee3e3f1744cb8ba85 /src/plugins | |
parent | a7c9d5ca9c754902baa0fa5a6ba8b28864611ca5 (diff) |
Cocoa: fix modal native dialogs with ongoing modal sessions
Commit 26db7de13d5885067844532b5a5814181a0ddf16 introduced the
modal session cleanup for Cocoa print dialog before running the
modal event loop for the dialog. Add the same cleanup for Cocoa
file, font and color dialog helpers.
Task-number: QTBUG-28146
Change-Id: Ifeb7c82566db35f0c6654be7762e9aaffbafb900
Reviewed-by: Andy Shaw <andy.shaw@digia.com>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm | 4 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm | 5 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm | 4 |
3 files changed, 13 insertions, 0 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm index 389ba357d5..1deb92cb04 100644 --- a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm @@ -282,6 +282,10 @@ static NSButton *macCreateButton(const char *text, NSView *superview) mDialogIsExecuting = true; [mColorPanel setDelegate:self]; [mColorPanel setContinuous:YES]; + // Call processEvents in case the event dispatcher has been interrupted, and needs to do + // cleanup of modal sessions. Do this before showing the native dialog, otherwise it will + // close down during the cleanup. + qApp->processEvents(QEventLoop::ExcludeUserInputEvents | QEventLoop::ExcludeSocketNotifiers); [NSApp runModalForWindow:mColorPanel]; return (mResultCode == NSOKButton); } diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm index 682ef48cda..f9122f56d1 100644 --- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm @@ -248,6 +248,11 @@ static QString strippedText(QString s) [mSavePanel setDirectoryURL:selectable ? [NSURL fileURLWithPath:QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.filePath())] : [NSURL fileURLWithPath:QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.path())]]; + + // Call processEvents in case the event dispatcher has been interrupted, and needs to do + // cleanup of modal sessions. Do this before showing the native dialog, otherwise it will + // close down during the cleanup. + qApp->processEvents(QEventLoop::ExcludeUserInputEvents | QEventLoop::ExcludeSocketNotifiers); mReturnCode = [mSavePanel runModal]; QAbstractEventDispatcher::instance()->interrupt(); diff --git a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm index ad93310f54..5ccd019a9b 100644 --- a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm @@ -301,6 +301,10 @@ static QFont qfontForCocoaFont(NSFont *cocoaFont, const QFont &resolveFont) { mDialogIsExecuting = true; [mFontPanel setDelegate:self]; + // Call processEvents in case the event dispatcher has been interrupted, and needs to do + // cleanup of modal sessions. Do this before showing the native dialog, otherwise it will + // close down during the cleanup. + qApp->processEvents(QEventLoop::ExcludeUserInputEvents | QEventLoop::ExcludeSocketNotifiers); [NSApp runModalForWindow:mFontPanel]; return (mResultCode == NSOKButton); } |