From 2caa16ff98348b043ecc3598e5b9af4a2e2ae3bc Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Thu, 8 Oct 2009 17:25:05 +0200 Subject: Fixed crash when printing to files under Cocoa When we select save as PDF in the print dialog, we get a new PMPrintSession in the printInfo object, while our stored one is deleted, so we update the pointer to be on the safe side Reviewed-by: msorvig --- src/gui/dialogs/qprintdialog_mac.mm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/gui/dialogs/qprintdialog_mac.mm b/src/gui/dialogs/qprintdialog_mac.mm index a7587b1..667fc40 100644 --- a/src/gui/dialogs/qprintdialog_mac.mm +++ b/src/gui/dialogs/qprintdialog_mac.mm @@ -166,6 +166,12 @@ QT_USE_NAMESPACE } // Keep us in sync with file output PMDestinationType dest; + + // If the user selected print to file, the session has been + // changed behind our back and our d->ep->session object is a + // dangling pointer. Update it based on the "current" session + d->ep->session = static_cast([d->ep->printInfo PMPrintSession]); + PMSessionGetDestinationType(d->ep->session, d->ep->settings, &dest); if (dest == kPMDestinationFile) { QCFType file; -- cgit v0.12