diff options
author | Jun Fang <jun_fang@foxitsoftware.com> | 2015-02-17 04:52:09 -0800 |
---|---|---|
committer | Jun Fang <jun_fang@foxitsoftware.com> | 2015-02-17 04:52:09 -0800 |
commit | 54d8c39002a0f8e3925de888226d22f157987a34 (patch) | |
tree | 1d601850dd6828bd448caf01c264bcc81b120ac7 /fpdfsdk | |
parent | b7cb36aba7d32c506ee921cb7558b8effd4b2fa1 (diff) | |
download | pdfium-54d8c39002a0f8e3925de888226d22f157987a34.tar.xz |
Set the view pointer as NULL after its xfa doc is released
BUG=452794
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/928803002
Diffstat (limited to 'fpdfsdk')
-rw-r--r-- | fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h | 11 | ||||
-rw-r--r-- | fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp | 27 |
2 files changed, 13 insertions, 25 deletions
diff --git a/fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h b/fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h index fadded858f..317200c2fa 100644 --- a/fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h +++ b/fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h @@ -14,6 +14,7 @@ class CPDFSDK_Document; class CPDFDoc_Environment;
class IFXJS_Runtime;
class IFXJS_Context;
+class IXFA_DocHandler;
class CPDFXFA_Document : public IXFA_DocProvider, public CFX_Object
{
@@ -22,7 +23,6 @@ public: ~CPDFXFA_Document();
FX_BOOL LoadXFADoc();
- void CloseXFADoc();
CPDFXFA_App* GetApp() {return m_pApp;}
CPDF_Document* GetPDFDoc() { return m_pPDFDoc; }
XFA_HDOC GetXFADoc() { return m_pXFADoc; }
@@ -128,6 +128,15 @@ public: void _ClearChangeMark();
private:
+ void CloseXFADoc(IXFA_DocHandler* pDoc) {
+ if (pDoc) {
+ pDoc->CloseDoc(m_pXFADoc);
+ pDoc->ReleaseDoc(m_pXFADoc);
+ m_pXFADoc = NULL;
+ m_pXFADocView = NULL;
+ }
+ }
+
CPDF_Document* m_pPDFDoc;
XFA_HDOC m_pXFADoc;
IXFA_DocView* m_pXFADocView;
diff --git a/fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp b/fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp index d8c08cc2a5..f13870697b 100644 --- a/fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp +++ b/fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp @@ -13,19 +13,6 @@ #include "../../include/fpdfxfa/fpdfxfa_page.h"
#include "../../include/javascript/IJavaScript.h"
-
-
-#define IDS_XFA_StringMonth_April "April"
-#define IDS_XFA_StringMonth_May "May"
-#define IDS_XFA_StringMonth_June "June"
-#define IDS_XFA_StringMonth_July "July"
-#define IDS_XFA_StringMonth_Aug "August"
-#define IDS_XFA_StringMonth_Sept "September"
-#define IDS_XFA_StringMonth_Oct "October"
-#define IDS_XFA_StringMonth_Nov "November"
-#define IDS_XFA_StringMonth_Dec "December"
-#define IDS_XFA_String_Today "Today"
-#define IDS_XFA_ValidateLimit "Message limit exceeded. Remaining %d validation errors not reported."
#define IDS_XFA_Validate_Input "At least one required field was empty. Please fill in the required fields\r\n(highlighted) before continuing."
// submit
@@ -78,9 +65,7 @@ CPDFXFA_Document::~CPDFXFA_Document() IXFA_DocHandler* pDocHandler = pApp->GetDocHandler();
if (pDocHandler)
{
- pDocHandler->CloseDoc(m_pXFADoc);
- pDocHandler->ReleaseDoc(m_pXFADoc);
- m_pXFADoc = NULL;
+ CloseXFADoc(pDocHandler);
}
}
}
@@ -129,10 +114,7 @@ FX_BOOL CPDFXFA_Document::LoadXFADoc() iStatus = pDocHandler->DoLoad(m_pXFADoc, NULL);
if (iStatus != 100)
{
- pDocHandler->CloseDoc(m_pXFADoc);
- pDocHandler->ReleaseDoc(m_pXFADoc);
- m_pXFADoc = NULL;
-
+ CloseXFADoc(pDocHandler);
SetLastError(FPDF_ERR_XFALOAD);
return FALSE;
}
@@ -149,10 +131,7 @@ FX_BOOL CPDFXFA_Document::LoadXFADoc() if (m_pXFADocView->StartLayout() < 0)
{
- pDocHandler->CloseDoc(m_pXFADoc);
- pDocHandler->ReleaseDoc(m_pXFADoc);
- m_pXFADoc = NULL;
-
+ CloseXFADoc(pDocHandler);
SetLastError(FPDF_ERR_XFALAYOUT);
return FALSE;
}
|