summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2010-12-01 13:46:24 +0300
committeraxis <qt-info@nokia.com>2010-12-20 16:14:33 +0100
commit50af3716c956be0f50fdd896925da7af91d5da2c (patch)
tree880c47d07f6d9b536da32d2c08acfacdcc1df45a
parented2abc6f5d8b2fe9e819d473768767c11f9c83ba (diff)
downloadqt4-tools-50af3716c956be0f50fdd896925da7af91d5da2c.tar.gz
QPrinterInfo::supportedPaperSizes(): return early if the info is invalid
e.g. don't report supported paper sized in any case Merge-request: 2516 Signed-off-by: axis
-rw-r--r--src/gui/painting/qprinterinfo_mac.cpp2
-rw-r--r--src/gui/painting/qprinterinfo_unix.cpp3
-rw-r--r--src/gui/painting/qprinterinfo_win.cpp2
3 files changed, 7 insertions, 0 deletions
diff --git a/src/gui/painting/qprinterinfo_mac.cpp b/src/gui/painting/qprinterinfo_mac.cpp
index 8d412174ec..033682a208 100644
--- a/src/gui/painting/qprinterinfo_mac.cpp
+++ b/src/gui/painting/qprinterinfo_mac.cpp
@@ -87,6 +87,8 @@ QList<QPrinter::PaperSize> QPrinterInfo::supportedPaperSizes() const
const Q_D(QPrinterInfo);
QList<QPrinter::PaperSize> paperSizes;
+ if (isNull())
+ return paperSizes;
PMPrinter cfPrn = PMPrinterCreateFromPrinterID(QCFString::toCFStringRef(d->name));
if (!cfPrn)
diff --git a/src/gui/painting/qprinterinfo_unix.cpp b/src/gui/painting/qprinterinfo_unix.cpp
index be24bd78ce..af2e52a613 100644
--- a/src/gui/painting/qprinterinfo_unix.cpp
+++ b/src/gui/painting/qprinterinfo_unix.cpp
@@ -898,6 +898,9 @@ QList<QPrinter::PaperSize> QPrinterInfo::supportedPaperSizes() const
#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY)
const Q_D(QPrinterInfo);
+ if (isNull())
+ return d->paperSizes;
+
if (!d->hasPaperSizes) {
d->hasPaperSizes = true;
diff --git a/src/gui/painting/qprinterinfo_win.cpp b/src/gui/painting/qprinterinfo_win.cpp
index f7b6874bea..2d25063434 100644
--- a/src/gui/painting/qprinterinfo_win.cpp
+++ b/src/gui/painting/qprinterinfo_win.cpp
@@ -100,6 +100,8 @@ QList<QPrinter::PaperSize> QPrinterInfo::supportedPaperSizes() const
const Q_D(QPrinterInfo);
QList<QPrinter::PaperSize> paperSizes;
+ if (isNull())
+ return paperSizes;
DWORD size = DeviceCapabilities(reinterpret_cast<const wchar_t*>(d->name.utf16()),
NULL, DC_PAPERS, NULL, NULL);