summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorPrasanth Ullattil <prasanth.ullattil@nokia.com>2010-04-15 10:34:16 (GMT)
committerPrasanth Ullattil <prasanth.ullattil@nokia.com>2010-04-15 11:29:03 (GMT)
commit0d80dbc176afa997af7d897344e5a8bfec0317dc (patch)
treedf8002ccf8908ee7e56bad4fcff865b0381f4563 /src/gui
parente4282111378ce67a1ae9c235efbd89b327f1bb91 (diff)
downloadQt-0d80dbc176afa997af7d897344e5a8bfec0317dc.zip
Qt-0d80dbc176afa997af7d897344e5a8bfec0317dc.tar.gz
Qt-0d80dbc176afa997af7d897344e5a8bfec0317dc.tar.bz2
Crash while printing from the portedcanvas example on Mac Cocoa.
The PMPrintSession inside the NSPrintInfo can get changed by the NSPageLayout. Refresh the session pointer saved in the QMacPrintEnginePrivate after showing the page setup dialog. Task-number: QTBUG-9880 Reviewed-by: Trond
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/dialogs/qpagesetupdialog_mac.mm5
-rw-r--r--src/gui/painting/qprintengine_mac.mm5
2 files changed, 9 insertions, 1 deletions
diff --git a/src/gui/dialogs/qpagesetupdialog_mac.mm b/src/gui/dialogs/qpagesetupdialog_mac.mm
index 13ffa05..cfcde0f 100644
--- a/src/gui/dialogs/qpagesetupdialog_mac.mm
+++ b/src/gui/dialogs/qpagesetupdialog_mac.mm
@@ -232,6 +232,11 @@ void QPageSetupDialogPrivate::openCocoaPageLayout(Qt::WindowModality modality)
void QPageSetupDialogPrivate::closeCocoaPageLayout()
{
+ // NSPageLayout can change the session behind our back and then our
+ // d->ep->session object will become a dangling pointer. Update it
+ // based on the "current" session
+ ep->session = static_cast<PMPrintSession>([ep->printInfo PMPrintSession]);
+
[pageLayout release];
pageLayout = 0;
}
diff --git a/src/gui/painting/qprintengine_mac.mm b/src/gui/painting/qprintengine_mac.mm
index 3d5d1d5..a548225 100644
--- a/src/gui/painting/qprintengine_mac.mm
+++ b/src/gui/painting/qprintengine_mac.mm
@@ -114,8 +114,11 @@ bool QMacPrintEngine::end()
Q_D(QMacPrintEngine);
if (d->state == QPrinter::Aborted)
return true; // I was just here a function call ago :)
- if(d->paintEngine->type() == QPaintEngine::CoreGraphics)
+ if(d->paintEngine->type() == QPaintEngine::CoreGraphics) {
+ // We dont need the paint engine to call restoreGraphicsState()
+ static_cast<QCoreGraphicsPaintEngine*>(d->paintEngine)->d_func()->stackCount = 0;
static_cast<QCoreGraphicsPaintEngine*>(d->paintEngine)->d_func()->hd = 0;
+ }
d->paintEngine->end();
if (d->state != QPrinter::Idle)
d->releaseSession();