From 13e3f269fd0cbebaded595416fc8fe907fbdc730 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Wed, 16 Apr 2014 22:09:36 +0200 Subject: [PATCH] QPrintDialog - Fix Mac reference counting error. "key" is accessed with a "Get" function and should not be released. Switch from using QCFString to a CFStringsRef. Change-Id: Id4eecc642de8698314fc57d44af05c202966b11c Reviewed-by: Jake Petroules Reviewed-by: John Layt --- src/printsupport/dialogs/qprintdialog_mac.mm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/printsupport/dialogs/qprintdialog_mac.mm b/src/printsupport/dialogs/qprintdialog_mac.mm index 33a11cc079..ef3e88be39 100644 --- a/src/printsupport/dialogs/qprintdialog_mac.mm +++ b/src/printsupport/dialogs/qprintdialog_mac.mm @@ -160,13 +160,13 @@ QT_USE_NAMESPACE PMOrientation orientation; PMGetOrientation(pageFormat, &orientation); QPageSize pageSize; - QCFString key; + CFStringRef key; double width = 0; double height = 0; // If the PPD name is empty then is custom, for some reason PMPaperIsCustom doesn't work here PMPaperGetPPDPaperName(paper, &key); if (PMPaperGetWidth(paper, &width) == noErr && PMPaperGetHeight(paper, &height) == noErr) { - QString ppdKey = key; + QString ppdKey = QString::fromCFString(key); if (ppdKey.isEmpty()) { // Is using a custom page size as defined in the Print Dialog custom settings using mm or inches. // We can't ask PMPaper what those units actually are, we can only get the point size which may return @@ -185,7 +185,7 @@ QT_USE_NAMESPACE pageSize = QPageSize(QSizeF(w / 100.0, h / 100.0), QPageSize::Inch); } } else { - pageSize = QPlatformPrintDevice::createPageSize(key, QSize(width, height), QString()); + pageSize = QPlatformPrintDevice::createPageSize(ppdKey, QSize(width, height), QString()); } } if (pageSize.isValid() && !pageSize.isEquivalentTo(printer->pageLayout().pageSize()))