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 <jake.petroules@petroules.com> Reviewed-by: John Layt <jlayt@kde.org>
This commit is contained in:
parent
4e4b2d6701
commit
13e3f269fd
@ -160,13 +160,13 @@ QT_USE_NAMESPACE
|
|||||||
PMOrientation orientation;
|
PMOrientation orientation;
|
||||||
PMGetOrientation(pageFormat, &orientation);
|
PMGetOrientation(pageFormat, &orientation);
|
||||||
QPageSize pageSize;
|
QPageSize pageSize;
|
||||||
QCFString key;
|
CFStringRef key;
|
||||||
double width = 0;
|
double width = 0;
|
||||||
double height = 0;
|
double height = 0;
|
||||||
// If the PPD name is empty then is custom, for some reason PMPaperIsCustom doesn't work here
|
// If the PPD name is empty then is custom, for some reason PMPaperIsCustom doesn't work here
|
||||||
PMPaperGetPPDPaperName(paper, &key);
|
PMPaperGetPPDPaperName(paper, &key);
|
||||||
if (PMPaperGetWidth(paper, &width) == noErr && PMPaperGetHeight(paper, &height) == noErr) {
|
if (PMPaperGetWidth(paper, &width) == noErr && PMPaperGetHeight(paper, &height) == noErr) {
|
||||||
QString ppdKey = key;
|
QString ppdKey = QString::fromCFString(key);
|
||||||
if (ppdKey.isEmpty()) {
|
if (ppdKey.isEmpty()) {
|
||||||
// Is using a custom page size as defined in the Print Dialog custom settings using mm or inches.
|
// 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
|
// 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);
|
pageSize = QPageSize(QSizeF(w / 100.0, h / 100.0), QPageSize::Inch);
|
||||||
}
|
}
|
||||||
} else {
|
} 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()))
|
if (pageSize.isValid() && !pageSize.isEquivalentTo(printer->pageLayout().pageSize()))
|
||||||
|
Loading…
Reference in New Issue
Block a user