*** dialogs/qprintdialog_mac.mm 2013-03-28 15:12:25.000000000 -0700 --- dialogs/images/irfan_qprintdialog_mac.m 2013-03-28 15:15:24.000000000 -0700 *************** *** 286,291 **** --- 286,296 ---- printPanel = [NSPrintPanel printPanel]; QT_MANGLE_NAMESPACE(QCocoaPrintPanelDelegate) *delegate = [[QT_MANGLE_NAMESPACE(QCocoaPrintPanelDelegate) alloc] init]; [printPanel setOptions:macOptions]; + // 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 (QTBUG-17913): + qApp->processEvents(QEventLoop::ExcludeUserInputEvents, QEventLoop::ExcludeSocketNotifiers); + if (modality == Qt::ApplicationModal) { int rval = [printPanel runModalWithPrintInfo:ep->printInfo];