diff options
author | thestig <thestig@chromium.org> | 2016-04-13 13:18:21 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-13 13:18:21 -0700 |
commit | 9f3dbbc54c6981f069b57e6714393ac6c0c64231 (patch) | |
tree | 9f76b6cee117e34a737bd46f146356931786d3cc /fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp | |
parent | f063abf4d50ab466080714df584660854ceb8709 (diff) | |
download | pdfium-9f3dbbc54c6981f069b57e6714393ac6c0c64231.tar.xz |
Cleanup CPDFXFA_Page.
- Use std::unique_ptr.
- Make dtor protected.
- Simplify logic.
- Remove unused bits from CXFA_FFPageView as well.
Review URL: https://codereview.chromium.org/1878963004
Diffstat (limited to 'fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp')
-rw-r--r-- | fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp b/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp index aa1a1a82c7..7fa258c506 100644 --- a/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp +++ b/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp @@ -4,12 +4,13 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h" + #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" #include "fpdfsdk/fpdfxfa/include/fpdfxfa_app.h" -#include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h" #include "fpdfsdk/fpdfxfa/include/fpdfxfa_page.h" #include "fpdfsdk/fpdfxfa/include/fpdfxfa_util.h" #include "fpdfsdk/include/fsdk_define.h" @@ -168,7 +169,7 @@ CPDFXFA_Page* CPDFXFA_Document::GetPage(int page_index) { return pPage; pPage = new CPDFXFA_Page(this, page_index); if (!pPage->LoadPage()) { - delete pPage; + pPage->Release(); return nullptr; } m_XFAPageList.SetAt(page_index, pPage); @@ -508,8 +509,6 @@ void CPDFXFA_Document::PageViewEvent(CXFA_FFPageView* pPageView, m_pSDKDoc->RemovePageView(pPage); CXFA_FFPageView* pXFAPageView = pXFADocView->GetPageView(iPageIter); pPage->SetXFAPageView(pXFAPageView); - if (pXFAPageView) - pXFAPageView->LoadPageView(nullptr); } int flag = (nNewCount < m_nPageCount) ? FXFA_PAGEVIEWEVENT_POSTREMOVED |