Don't release the printer after using it to change a property
The printer should not be released after changing a property on it as it is still needed by QPrinter elsewhere. It is released as appropriate automatically already. Task-number: QTBUG-32831 Change-Id: Idb2d98b25b62f343015a0a0fb3c9a0d506546132 Reviewed-by: Liang Qi <liang.qi@digia.com> Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
This commit is contained in:
parent
feacbdb746
commit
3e078cf36d
@ -187,10 +187,8 @@ void QMacPrintEnginePrivate::setPaperName(const QString &name)
|
||||
|
||||
if (PMSessionGetCurrentPrinter(session(), &printer) == noErr) {
|
||||
CFArrayRef array;
|
||||
if (PMPrinterGetPaperList(printer, &array) != noErr) {
|
||||
PMRelease(printer);
|
||||
if (PMPrinterGetPaperList(printer, &array) != noErr)
|
||||
return;
|
||||
}
|
||||
int count = CFArrayGetCount(array);
|
||||
for (int i = 0; i < count; ++i) {
|
||||
PMPaper paper = static_cast<PMPaper>(const_cast<void *>(CFArrayGetValueAtIndex(array, i)));
|
||||
@ -208,7 +206,6 @@ void QMacPrintEnginePrivate::setPaperName(const QString &name)
|
||||
}
|
||||
}
|
||||
}
|
||||
PMRelease(printer);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user