diff options
author | Gabriel de Dietrich <gabriel.dedietrich@qt.io> | 2016-11-01 15:28:17 -0700 |
---|---|---|
committer | Morten Johan Sørvig <morten.sorvig@qt.io> | 2016-11-08 12:30:06 +0000 |
commit | ae8d3d69d68e7f3da1b0f524e12496387aff26ec (patch) | |
tree | ac7aac5805cada0503a91a0ae5d395b39dfdaad4 /src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm | |
parent | ffe72840a34ed7c99294f29f85828c5d5fad728f (diff) |
macOS: Clear event dispatcher interrupt state
A pending interrupt of a QEventLoop may interfere with
native runModal calls, resulting in Cocoa's main event
loop to be stopped unexpectedly.
After commit 9ab60b9c processEvents() no longer resets
the event dispatcher interrupt flag.
Add QCocoaEventDispatcher::clearCurrentThreadCocoa
EventDispatcherInterruptFlag(). Use it to clear the
interrupt state before calling runModal and variants.
Work around the inability to use platform API in
the print support code.
Change-Id: I52f26f99a63cbb46969db42f65b09a3c3119ad15
Task-number: QTBUG-56746
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm index 5b27dc1da9..eb800afd47 100644 --- a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm @@ -43,6 +43,7 @@ #include <private/qfontengine_coretext_p.h> #include "qcocoahelpers.h" +#include "qcocoaeventdispatcher.h" #import <AppKit/AppKit.h> @@ -313,6 +314,10 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSFontPanelDelegate); // 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); + + // Make sure we don't interrupt the runModalForWindow call. + QCocoaEventDispatcher::clearCurrentThreadCocoaEventDispatcherInterruptFlag(); + [NSApp runModalForWindow:mFontPanel]; mDialogIsExecuting = false; return (mResultCode == NSOKButton); |