diff options
author | Gabriel de Dietrich <gabriel.dedietrich@qt.io> | 2016-11-01 15:28:17 -0700 |
---|---|---|
committer | Jani Heikkinen <jani.heikkinen@qt.io> | 2016-11-08 10:45:45 +0000 |
commit | e79b40ee8f78a9669ed0b7b6def2a69ef7ab02fa (patch) | |
tree | 9dd88af03555174565470edefa6222742cf44a08 /src/printsupport/dialogs/qpagesetupdialog_mac.mm | |
parent | 3f347262da369b0a4adae89750f9fe0247fcd486 (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: I3e03e7ec21ff6c49442c7a6e803a7200aac0b58d
Task-number: QTBUG-56746
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
Diffstat (limited to 'src/printsupport/dialogs/qpagesetupdialog_mac.mm')
-rw-r--r-- | src/printsupport/dialogs/qpagesetupdialog_mac.mm | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/printsupport/dialogs/qpagesetupdialog_mac.mm b/src/printsupport/dialogs/qpagesetupdialog_mac.mm index e3e7523a16..c29b911e35 100644 --- a/src/printsupport/dialogs/qpagesetupdialog_mac.mm +++ b/src/printsupport/dialogs/qpagesetupdialog_mac.mm @@ -133,6 +133,11 @@ void QMacPageSetupDialogPrivate::openCocoaPageLayout(Qt::WindowModality modality QT_MANGLE_NAMESPACE(QCocoaPageLayoutDelegate) *delegate = [[QT_MANGLE_NAMESPACE(QCocoaPageLayoutDelegate) alloc] initWithNSPrintInfo:printInfo]; if (modality == Qt::ApplicationModal) { + + // Make sure we don't interrupt the runModalWithPrintInfo call. + (void) QMetaObject::invokeMethod(qApp->platformNativeInterface(), + "clearCurrentThreadCocoaEventDispatcherInterruptFlag"); + int rval = [pageLayout runModalWithPrintInfo:printInfo]; [delegate pageLayoutDidEnd:pageLayout returnCode:rval contextInfo:q]; } else { |