Change the clear order of pDocPage and pDocRender
authorBo Xu <bo_xu@foxitsoftware.com>
Tue, 21 Oct 2014 21:50:16 +0000 (14:50 -0700)
committerBo Xu <bo_xu@foxitsoftware.com>
Tue, 21 Oct 2014 21:50:16 +0000 (14:50 -0700)
pTransfer function is released in pDocRender cleanup but is still being accessed in
~CPDF_GeneralStateData in pDocPage cleanup.

BUG=419320
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/662063003

core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp

index 635fc6b..c3e35d8 100644 (file)
@@ -95,13 +95,13 @@ void CPDF_Document::LoadPages()
 extern void FPDF_TTFaceMapper_ReleaseDoc(CPDF_Document*);
 CPDF_Document::~CPDF_Document()
 {
-    if (m_pDocRender) {
-        CPDF_ModuleMgr::Get()->GetRenderModule()->DestroyDocData(m_pDocRender);
-    }
     if (m_pDocPage) {
         CPDF_ModuleMgr::Get()->GetPageModule()->ReleaseDoc(this);
         CPDF_ModuleMgr::Get()->GetPageModule()->ClearStockFont(this);
     }
+    if (m_pDocRender) {
+        CPDF_ModuleMgr::Get()->GetRenderModule()->DestroyDocData(m_pDocRender);
+    }
 }
 #define                FX_MAX_PAGE_LEVEL                       1024
 CPDF_Dictionary* CPDF_Document::_FindPDFPage(CPDF_Dictionary* pPages, int iPage, int nPagesToGo, int level)