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

Side by Side 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, 7 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "core/fxcrt/include/fx_ext.h" 7 #include "core/fxcrt/include/fx_ext.h"
8 #include "xfa/fxfa/app/xfa_ffnotify.h" 8 #include "xfa/fxfa/app/xfa_ffnotify.h"
9 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" 9 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h"
10 #include "xfa/fxfa/parser/xfa_basic_imp.h" 10 #include "xfa/fxfa/parser/xfa_basic_imp.h"
(...skipping 27 matching lines...) Expand all
38 m_pScriptLayout(nullptr), 38 m_pScriptLayout(nullptr),
39 m_pScriptSignature(nullptr), 39 m_pScriptSignature(nullptr),
40 m_eCurVersionMode(XFA_VERSION_DEFAULT), 40 m_eCurVersionMode(XFA_VERSION_DEFAULT),
41 m_dwDocFlags(0) { 41 m_dwDocFlags(0) {
42 ASSERT(m_pParser); 42 ASSERT(m_pParser);
43 } 43 }
44 CXFA_Document::~CXFA_Document() { 44 CXFA_Document::~CXFA_Document() {
45 delete m_pRootNode; 45 delete m_pRootNode;
46 PurgeNodes(); 46 PurgeNodes();
47 } 47 }
48
48 void CXFA_Document::ClearLayoutData() { 49 void CXFA_Document::ClearLayoutData() {
49 if (m_pLayoutProcessor) { 50 delete m_pLayoutProcessor;
50 delete m_pLayoutProcessor; 51 m_pLayoutProcessor = nullptr;
51 m_pLayoutProcessor = NULL; 52
52 }
53 if (m_pScriptContext) { 53 if (m_pScriptContext) {
54 m_pScriptContext->Release(); 54 m_pScriptContext->Release();
55 m_pScriptContext = NULL; 55 m_pScriptContext = nullptr;
56 } 56 }
57 if (m_pLocalMgr) { 57 delete m_pLocalMgr;
58 delete m_pLocalMgr; 58 m_pLocalMgr = nullptr;
59 m_pLocalMgr = NULL; 59 delete m_pScriptDataWindow;
60 } 60 m_pScriptDataWindow = nullptr;
61 if (m_pScriptDataWindow) { 61 delete m_pScriptEvent;
62 delete m_pScriptDataWindow; 62 m_pScriptEvent = nullptr;
63 m_pScriptDataWindow = NULL; 63 delete m_pScriptHost;
64 } 64 m_pScriptHost = nullptr;
65 if (m_pScriptEvent) { 65 delete m_pScriptLog;
66 delete m_pScriptEvent; 66 m_pScriptLog = nullptr;
67 m_pScriptEvent = NULL; 67 delete m_pScriptLayout;
68 } 68 m_pScriptLayout = nullptr;
69 if (m_pScriptHost) { 69 delete m_pScriptSignature;
70 delete m_pScriptHost; 70 m_pScriptSignature = nullptr;
71 m_pScriptHost = NULL;
72 }
73 if (m_pScriptLog) {
74 delete m_pScriptLog;
75 m_pScriptLog = NULL;
76 }
77 if (m_pScriptLayout) {
78 delete m_pScriptLayout;
79 m_pScriptLayout = NULL;
80 }
81 if (m_pScriptSignature) {
82 delete m_pScriptSignature;
83 m_pScriptSignature = NULL;
84 }
85 } 71 }
72
86 void CXFA_Document::SetRoot(CXFA_Node* pNewRoot) { 73 void CXFA_Document::SetRoot(CXFA_Node* pNewRoot) {
87 if (m_pRootNode) { 74 if (m_pRootNode) {
88 AddPurgeNode(m_pRootNode); 75 AddPurgeNode(m_pRootNode);
89 } 76 }
90 m_pRootNode = pNewRoot; 77 m_pRootNode = pNewRoot;
91 RemovePurgeNode(pNewRoot); 78 RemovePurgeNode(pNewRoot);
92 } 79 }
93 CXFA_FFNotify* CXFA_Document::GetNotify() const { 80 CXFA_FFNotify* CXFA_Document::GetNotify() const {
94 return m_pParser->GetNotify(); 81 return m_pParser->GetNotify();
95 } 82 }
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 if (!mIDMap.Lookup(FX_HashCode_GetW(wsID, false), pProtoNode)) { 414 if (!mIDMap.Lookup(FX_HashCode_GetW(wsID, false), pProtoNode)) {
428 continue; 415 continue;
429 } 416 }
430 } 417 }
431 if (!pProtoNode) { 418 if (!pProtoNode) {
432 continue; 419 continue;
433 } 420 }
434 XFA_ProtoMerge_MergeNode(this, pUseHrefNode, pProtoNode); 421 XFA_ProtoMerge_MergeNode(this, pUseHrefNode, pProtoNode);
435 } 422 }
436 } 423 }
OLDNEW
« 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