summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdfview.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-05-16 14:11:30 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-05-16 21:51:53 +0000
commit9792f16f3ef27a1e0c7f0526cc69637a158e3010 (patch)
tree861baddf94e96d7de9bc2c2b27409872d56ebcee /fpdfsdk/fpdfview.cpp
parentcc205131b021ebded854958973f445ed121da1b8 (diff)
downloadpdfium-9792f16f3ef27a1e0c7f0526cc69637a158e3010.tar.xz
Properly ref-count CPDFXFA_Page
Change-Id: Ibd1ebe4191f61e20d815de7f1a1094d78b72e6a7 Reviewed-on: https://pdfium-review.googlesource.com/5391 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdfview.cpp')
-rw-r--r--fpdfsdk/fpdfview.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp
index 5fb963abd3..f8078073b7 100644
--- a/fpdfsdk/fpdfview.cpp
+++ b/fpdfsdk/fpdfview.cpp
@@ -628,7 +628,7 @@ DLLEXPORT FPDF_PAGE STDCALL FPDF_LoadPage(FPDF_DOCUMENT document,
return nullptr;
#ifdef PDF_ENABLE_XFA
- return pDoc->GetXFAPage(page_index);
+ return pDoc->GetXFAPage(page_index).Leak();
#else // PDF_ENABLE_XFA
CPDF_Dictionary* pDict = pDoc->GetPage(page_index);
if (!pDict)
@@ -974,7 +974,8 @@ DLLEXPORT void STDCALL FPDF_ClosePage(FPDF_PAGE page) {
if (!page)
return;
#ifdef PDF_ENABLE_XFA
- pPage->Release();
+ // Take it back across the API and throw it away.
+ CFX_RetainPtr<CPDFXFA_Page>().Unleak(pPage);
#else // PDF_ENABLE_XFA
CPDFSDK_PageView* pPageView =
static_cast<CPDFSDK_PageView*>(pPage->GetView());
@@ -1176,7 +1177,7 @@ DLLEXPORT int STDCALL FPDF_GetPageSizeByIndex(FPDF_DOCUMENT document,
int count = pDoc->GetPageCount();
if (page_index < 0 || page_index >= count)
return false;
- CPDFXFA_Page* pPage = pDoc->GetXFAPage(page_index);
+ CFX_RetainPtr<CPDFXFA_Page> pPage = pDoc->GetXFAPage(page_index);
if (!pPage)
return false;
*width = pPage->GetPageWidth();