summaryrefslogtreecommitdiff
path: root/fxjs
diff options
context:
space:
mode:
Diffstat (limited to 'fxjs')
-rw-r--r--fxjs/cjs_document.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/fxjs/cjs_document.cpp b/fxjs/cjs_document.cpp
index b90794a88d..66577062a6 100644
--- a/fxjs/cjs_document.cpp
+++ b/fxjs/cjs_document.cpp
@@ -1256,12 +1256,12 @@ CJS_Return CJS_Document::getPageNthWord(
if (!pPageDict)
return CJS_Return(false);
- CPDF_Page page(pDocument, pPageDict, true);
- page.ParseContent();
+ auto page = pdfium::MakeRetain<CPDF_Page>(pDocument, pPageDict, true);
+ page->ParseContent();
int nWords = 0;
WideString swRet;
- for (auto& pPageObj : *page.GetPageObjectList()) {
+ for (auto& pPageObj : *page->GetPageObjectList()) {
if (pPageObj->IsText()) {
CPDF_TextObject* pTextObj = pPageObj->AsText();
int nObjWords = CountWords(pTextObj);
@@ -1305,11 +1305,11 @@ CJS_Return CJS_Document::getPageNumWords(
if (!pPageDict)
return CJS_Return(false);
- CPDF_Page page(pDocument, pPageDict, true);
- page.ParseContent();
+ auto page = pdfium::MakeRetain<CPDF_Page>(pDocument, pPageDict, true);
+ page->ParseContent();
int nWords = 0;
- for (auto& pPageObj : *page.GetPageObjectList()) {
+ for (auto& pPageObj : *page->GetPageObjectList()) {
if (pPageObj->IsText())
nWords += CountWords(pPageObj->AsText());
}