summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorTrond Kjernåsen <trond@trolltech.com>2009-11-23 15:10:10 (GMT)
committerTrond Kjernåsen <trond@trolltech.com>2009-11-23 15:14:15 (GMT)
commitddd885ae9a46f8abcc4e5eb45bb4c53d7f86f4c2 (patch)
tree83d189e6feb3a0a2dcd047e2a7839c1d30830fba /src/gui
parent0bad605066f4cacabb2547b9b8895b69dac3d431 (diff)
downloadQt-ddd885ae9a46f8abcc4e5eb45bb4c53d7f86f4c2.zip
Qt-ddd885ae9a46f8abcc4e5eb45bb4c53d7f86f4c2.tar.gz
Qt-ddd885ae9a46f8abcc4e5eb45bb4c53d7f86f4c2.tar.bz2
Fixed endless loop when printing a QTextDocument.
If the user enters a valid page range, which lies outside of the actual number of printable pages, we can't detect that until the document has been paginated. Task-number: QTBUG-6051 Reviewed-by: Kim
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/text/qtextdocument.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index 048325c..523dd18 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -1767,6 +1767,12 @@ void QTextDocument::print(QPrinter *printer) const
fromPage = qMax(1, fromPage);
toPage = qMin(doc->pageCount(), toPage);
+ if (toPage < fromPage) {
+ // if the user entered a page range outside the actual number
+ // of printable pages, just return
+ return;
+ }
+
if (printer->pageOrder() == QPrinter::LastPageFirst) {
int tmp = fromPage;
fromPage = toPage;