diff options
author | thestig <thestig@chromium.org> | 2016-04-28 17:29:19 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-28 17:29:19 -0700 |
commit | 495bda110a6ea8e7a6fc313ec0232a9ca6e3cfdc (patch) | |
tree | 42abda300274f81009bdb9866e0f7e3f81164726 /xfa/fxfa/parser/xfa_document_imp.cpp | |
parent | a31098417852bdf13e693a6e0913e0706cf94098 (diff) | |
download | pdfium-495bda110a6ea8e7a6fc313ec0232a9ca6e3cfdc.tar.xz |
Do not check pointers before deleting them.
XFA edition.
Review-Url: https://codereview.chromium.org/1925363002
Diffstat (limited to 'xfa/fxfa/parser/xfa_document_imp.cpp')
-rw-r--r-- | xfa/fxfa/parser/xfa_document_imp.cpp | 55 |
1 files changed, 21 insertions, 34 deletions
diff --git a/xfa/fxfa/parser/xfa_document_imp.cpp b/xfa/fxfa/parser/xfa_document_imp.cpp index ad3fd70e0d..083fe24a7e 100644 --- a/xfa/fxfa/parser/xfa_document_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_imp.cpp @@ -45,44 +45,31 @@ CXFA_Document::~CXFA_Document() { delete m_pRootNode; PurgeNodes(); } + void CXFA_Document::ClearLayoutData() { - if (m_pLayoutProcessor) { - delete m_pLayoutProcessor; - m_pLayoutProcessor = NULL; - } + delete m_pLayoutProcessor; + m_pLayoutProcessor = nullptr; + if (m_pScriptContext) { m_pScriptContext->Release(); - m_pScriptContext = NULL; - } - if (m_pLocalMgr) { - delete m_pLocalMgr; - m_pLocalMgr = NULL; - } - if (m_pScriptDataWindow) { - delete m_pScriptDataWindow; - m_pScriptDataWindow = NULL; - } - if (m_pScriptEvent) { - delete m_pScriptEvent; - m_pScriptEvent = NULL; - } - if (m_pScriptHost) { - delete m_pScriptHost; - m_pScriptHost = NULL; - } - if (m_pScriptLog) { - delete m_pScriptLog; - m_pScriptLog = NULL; - } - if (m_pScriptLayout) { - delete m_pScriptLayout; - m_pScriptLayout = NULL; - } - if (m_pScriptSignature) { - delete m_pScriptSignature; - m_pScriptSignature = NULL; - } + m_pScriptContext = nullptr; + } + delete m_pLocalMgr; + m_pLocalMgr = nullptr; + delete m_pScriptDataWindow; + m_pScriptDataWindow = nullptr; + delete m_pScriptEvent; + m_pScriptEvent = nullptr; + delete m_pScriptHost; + m_pScriptHost = nullptr; + delete m_pScriptLog; + m_pScriptLog = nullptr; + delete m_pScriptLayout; + m_pScriptLayout = nullptr; + delete m_pScriptSignature; + m_pScriptSignature = nullptr; } + void CXFA_Document::SetRoot(CXFA_Node* pNewRoot) { if (m_pRootNode) { AddPurgeNode(m_pRootNode); |