summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Koenig <tobias.koenig@kdab.com>2016-08-24 14:10:09 +0200
committerTobias Koenig <tobias.koenig@kdab.com>2016-08-24 20:35:43 +0000
commite62e6b77818b4f25a796abea4c8679743e71cf45 (patch)
tree358290d36453743177980c8e441d1bb854055926
parent5ccb928983e8ff5e51989fab60ea413a5b418f29 (diff)
Fix loading of large PDF documents
Call FPDFAvail_IsPageAvail multiple times and check return value, otherwise the page won't be loaded completely. Change-Id: I9a6de3443eec6819be9b6eaa2a5b054329da4f80 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rw-r--r--src/pdf/qpdfdocument.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/pdf/qpdfdocument.cpp b/src/pdf/qpdfdocument.cpp
index 3ef947f..709c702 100644
--- a/src/pdf/qpdfdocument.cpp
+++ b/src/pdf/qpdfdocument.cpp
@@ -251,9 +251,15 @@ void QPdfDocumentPrivate::checkComplete()
QPdfMutexLocker lock;
- for (int i = 0, count = FPDF_GetPageCount(doc); i < count; ++i)
- if (!FPDFAvail_IsPageAvail(avail, i, this))
+ for (int i = 0, count = FPDF_GetPageCount(doc); i < count; ++i) {
+ int result = PDF_DATA_NOTAVAIL;
+ while (result == PDF_DATA_NOTAVAIL) {
+ result = FPDFAvail_IsPageAvail(avail, i, this);
+ }
+
+ if (result == PDF_DATA_ERROR)
loadComplete = false;
+ }
lock.unlock();