QPrintDialog OSX: don't crash if ApplicationModal and no parent

Task-number: QTBUG-32464
Change-Id: I5ee2741735255254c17555dfb977ce73941d3e22
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Liang Qi <liang.qi@digia.com>
This commit is contained in:
Shawn Rutledge 2013-07-23 15:48:41 +02:00 committed by The Qt Project
parent f2a611ce6c
commit 03855decfc

View File

@ -198,7 +198,9 @@ void QPrintDialogPrivate::openCocoaPrintPanel(Qt::WindowModality modality)
qApp->processEvents(QEventLoop::ExcludeUserInputEvents, QEventLoop::ExcludeSocketNotifiers);
QT_MANGLE_NAMESPACE(QCocoaPrintPanelDelegate) *delegate = [[QT_MANGLE_NAMESPACE(QCocoaPrintPanelDelegate) alloc] init];
if (modality == Qt::ApplicationModal) {
if (modality == Qt::ApplicationModal || !q->parentWidget()) {
if (modality == Qt::NonModal)
qWarning("QPrintDialog is required to be modal on OS X");
int rval = [printPanel runModalWithPrintInfo:printInfo];
[delegate printPanelDidEnd:printPanel returnCode:rval contextInfo:q];
} else {