diff options
author | Konstantin Ritt <ritt.ks@gmail.com> | 2010-12-01 10:46:24 (GMT) |
---|---|---|
committer | axis <qt-info@nokia.com> | 2010-12-20 15:14:33 (GMT) |
commit | 50af3716c956be0f50fdd896925da7af91d5da2c (patch) | |
tree | 880c47d07f6d9b536da32d2c08acfacdcc1df45a /src/gui | |
parent | ed2abc6f5d8b2fe9e819d473768767c11f9c83ba (diff) | |
download | Qt-50af3716c956be0f50fdd896925da7af91d5da2c.zip Qt-50af3716c956be0f50fdd896925da7af91d5da2c.tar.gz Qt-50af3716c956be0f50fdd896925da7af91d5da2c.tar.bz2 |
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
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/painting/qprinterinfo_mac.cpp | 2 | ||||
-rw-r--r-- | src/gui/painting/qprinterinfo_unix.cpp | 3 | ||||
-rw-r--r-- | src/gui/painting/qprinterinfo_win.cpp | 2 |
3 files changed, 7 insertions, 0 deletions
diff --git a/src/gui/painting/qprinterinfo_mac.cpp b/src/gui/painting/qprinterinfo_mac.cpp index 8d41217..033682a 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 be24bd7..af2e52a 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 f7b6874..2d25063 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); |