diff options
Diffstat (limited to 'fpdfsdk/fpdfxfa')
-rw-r--r-- | fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp | 2 | ||||
-rw-r--r-- | fpdfsdk/fpdfxfa/fpdfxfa_page.cpp | 9 | ||||
-rw-r--r-- | fpdfsdk/fpdfxfa/include/fpdfxfa_page.h | 7 |
3 files changed, 7 insertions, 11 deletions
diff --git a/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp b/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp index 4d2a559a39..7a9d074624 100644 --- a/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp +++ b/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp @@ -160,7 +160,7 @@ CPDFXFA_Page* CPDFXFA_Document::GetPage(int page_index) { if (nCount > 0 && page_index < nCount) { pPage = m_XFAPageList.GetAt(page_index); if (pPage) - pPage->AddRef(); + pPage->Retain(); } else { m_nPageCount = GetPageCount(); m_XFAPageList.SetSize(m_nPageCount); diff --git a/fpdfsdk/fpdfxfa/fpdfxfa_page.cpp b/fpdfsdk/fpdfxfa/fpdfxfa_page.cpp index 22c8f995f2..8dbbf4e07c 100644 --- a/fpdfsdk/fpdfxfa/fpdfxfa_page.cpp +++ b/fpdfsdk/fpdfxfa/fpdfxfa_page.cpp @@ -21,16 +21,9 @@ CPDFXFA_Page::CPDFXFA_Page(CPDFXFA_Document* pDoc, int page_index) m_iPageIndex(page_index), m_iRef(1) {} -CPDFXFA_Page::~CPDFXFA_Page() {} - -void CPDFXFA_Page::Release() { - if (--m_iRef > 0) - return; - +CPDFXFA_Page::~CPDFXFA_Page() { if (m_pDocument) m_pDocument->RemovePage(this); - - delete this; } FX_BOOL CPDFXFA_Page::LoadPDFPage() { diff --git a/fpdfsdk/fpdfxfa/include/fpdfxfa_page.h b/fpdfsdk/fpdfxfa/include/fpdfxfa_page.h index 0f278912d6..2e08f580ed 100644 --- a/fpdfsdk/fpdfxfa/include/fpdfxfa_page.h +++ b/fpdfsdk/fpdfxfa/include/fpdfxfa_page.h @@ -22,8 +22,11 @@ class CPDFXFA_Page { public: CPDFXFA_Page(CPDFXFA_Document* pDoc, int page_index); - void AddRef() { m_iRef++; } - void Release(); + void Retain() { m_iRef++; } + void Release() { + if (--m_iRef <= 0) + delete this; + } FX_BOOL LoadPage(); FX_BOOL LoadPDFPage(CPDF_Dictionary* pageDict); |