From 9792f16f3ef27a1e0c7f0526cc69637a158e3010 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 16 May 2017 14:11:30 -0700 Subject: Properly ref-count CPDFXFA_Page Change-Id: Ibd1ebe4191f61e20d815de7f1a1094d78b72e6a7 Reviewed-on: https://pdfium-review.googlesource.com/5391 Commit-Queue: Tom Sepez Reviewed-by: Lei Zhang --- fpdfsdk/fpdfxfa/cpdfxfa_page.h | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'fpdfsdk/fpdfxfa/cpdfxfa_page.h') diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_page.h b/fpdfsdk/fpdfxfa/cpdfxfa_page.h index 05b9238eb7..d990813282 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_page.h +++ b/fpdfsdk/fpdfxfa/cpdfxfa_page.h @@ -9,6 +9,7 @@ #include +#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/fx_system.h" class CFX_Matrix; @@ -17,15 +18,10 @@ class CPDF_Dictionary; class CPDF_Page; class CXFA_FFPageView; -class CPDFXFA_Page { +class CPDFXFA_Page : public CFX_Retainable { public: - CPDFXFA_Page(CPDFXFA_Context* pContext, int page_index); - - void Retain() { m_iRef++; } - void Release() { - if (--m_iRef <= 0) - delete this; - } + template + friend CFX_RetainPtr pdfium::MakeRetain(Args&&... args); bool LoadPage(); bool LoadPDFPage(CPDF_Dictionary* pageDict); @@ -68,7 +64,8 @@ class CPDFXFA_Page { protected: // Refcounted class. - ~CPDFXFA_Page(); + CPDFXFA_Page(CPDFXFA_Context* pContext, int page_index); + ~CPDFXFA_Page() override; bool LoadPDFPage(); bool LoadXFAPageView(); -- cgit v1.2.3