Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(662)

Unified Diff: xfa/fxfa/parser/xfa_document_imp.cpp

Issue 1925363002: Do not check pointers before deleting them. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « xfa/fxfa/app/xfa_textlayout.cpp ('k') | xfa/fxfa/parser/xfa_document_layout_imp.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fxfa/parser/xfa_document_imp.cpp
diff --git a/xfa/fxfa/parser/xfa_document_imp.cpp b/xfa/fxfa/parser/xfa_document_imp.cpp
index ad3fd70e0d033c28090f15a844049e1d92851f02..083fe24a7ee09894b4a0676f954d07ebda959404 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);
« no previous file with comments | « xfa/fxfa/app/xfa_textlayout.cpp ('k') | xfa/fxfa/parser/xfa_document_layout_imp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698