diff options
author | Morten Johan Sørvig <morten.sorvig@digia.com> | 2014-04-07 09:24:37 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-04-09 10:47:21 +0200 |
commit | 0e62671bc0e6df5385b5eb8841b490190e411987 (patch) | |
tree | 1bf7f413265ba0b291385aa395212e96e7ec9c26 /src/plugins/platforms | |
parent | adde66f0dd7154585af8a77578e39973b5973883 (diff) |
Cocoa: Fix crash when creating printer object.
Fix reference counting error in QCocoaPrintDevice::
createPageSize(). "key" is accessed with a "Get"
function and should not be released. Switch from
using QCFString to a plain CFStringsRef with manual
ref counting.
Task-number: QTBUG-38023
Change-Id: I04d661bffeb5b3122b0c3c8eaaffdd1af51842fd
Reviewed-by: John Layt <jlayt@kde.org>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoaprintdevice.mm | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaprintdevice.mm b/src/plugins/platforms/cocoa/qcocoaprintdevice.mm index 3061e84470..281b140e15 100644 --- a/src/plugins/platforms/cocoa/qcocoaprintdevice.mm +++ b/src/plugins/platforms/cocoa/qcocoaprintdevice.mm @@ -171,15 +171,18 @@ QPrint::DeviceState QCocoaPrintDevice::state() const QPageSize QCocoaPrintDevice::createPageSize(const PMPaper &paper) const { - QCFString key; + CFStringRef key; double width; double height; - QCFString localizedName; + CFStringRef localizedName; if (PMPaperGetPPDPaperName(paper, &key) == noErr && PMPaperGetWidth(paper, &width) == noErr && PMPaperGetHeight(paper, &height) == noErr && PMPaperCreateLocalizedName(paper, m_printer, &localizedName) == noErr) { - return(QPlatformPrintDevice::createPageSize(key, QSize(width, height), localizedName)); + QPageSize pageSize = QPlatformPrintDevice::createPageSize(QString::fromCFString(key),QSize(width, height), + QString::fromCFString(localizedName)); + CFRelease(localizedName); + return pageSize; } return QPageSize(); } |