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

Side by Side Diff: fpdfsdk/src/javascript/JS_Context.cpp

Issue 1195363002: Cleanup: Do not check pointers before deleting them, part 2. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: nits Created 5 years, 5 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 | « fpdfsdk/src/fpdftext.cpp ('k') | fpdfsdk/src/javascript/JS_Runtime.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 "../../include/javascript/JavaScript.h" 7 #include "../../include/javascript/JavaScript.h"
8 #include "../../include/javascript/IJavaScript.h" 8 #include "../../include/javascript/IJavaScript.h"
9 //#include "../../include/javascript/JS_ResMgr.h" 9 //#include "../../include/javascript/JS_ResMgr.h"
10 #include "../../include/javascript/JS_Context.h" 10 #include "../../include/javascript/JS_Context.h"
11 #include "../../include/javascript/JS_EventHandler.h" 11 #include "../../include/javascript/JS_EventHandler.h"
12 #include "../../include/javascript/JS_Runtime.h" 12 #include "../../include/javascript/JS_Runtime.h"
13 #include "../../include/javascript/resource.h" 13 #include "../../include/javascript/resource.h"
14 14
15 /* -------------------------- CJS_Context -------------------------- */ 15 /* -------------------------- CJS_Context -------------------------- */
16 16
17 CJS_Context::CJS_Context(CJS_Runtime* pRuntime) : 17 CJS_Context::CJS_Context(CJS_Runtime* pRuntime) :
18 m_pRuntime(pRuntime), 18 m_pRuntime(pRuntime),
19 m_bBusy(FALSE), 19 m_bBusy(FALSE),
20 m_bMsgBoxEnable(TRUE) 20 m_bMsgBoxEnable(TRUE)
21 { 21 {
22 m_pEventHandler = new CJS_EventHandler(this); 22 m_pEventHandler = new CJS_EventHandler(this);
23 } 23 }
24 24
25 CJS_Context::~CJS_Context(void) 25 CJS_Context::~CJS_Context(void)
26 { 26 {
27 » if (m_pEventHandler) 27 delete m_pEventHandler;
28 » {
29 » » delete m_pEventHandler;
30 » » m_pEventHandler = NULL;
31 » }
32 } 28 }
33 29
34 CPDFSDK_Document* CJS_Context::GetReaderDocument() 30 CPDFSDK_Document* CJS_Context::GetReaderDocument()
35 { 31 {
36 ASSERT(m_pRuntime != NULL); 32 ASSERT(m_pRuntime != NULL);
37 33
38 return m_pRuntime->GetReaderDocument(); 34 return m_pRuntime->GetReaderDocument();
39 } 35 }
40 36
41 CPDFDoc_Environment* CJS_Context::GetReaderApp() 37 CPDFDoc_Environment* CJS_Context::GetReaderApp()
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 ASSERT(m_pEventHandler != NULL); 341 ASSERT(m_pEventHandler != NULL);
346 m_pEventHandler->OnBatchExec(pTarget); 342 m_pEventHandler->OnBatchExec(pTarget);
347 } 343 }
348 344
349 void CJS_Context::OnMenu_Exec(CPDFSDK_Document* pTarget,const CFX_WideString& st rTargetName) 345 void CJS_Context::OnMenu_Exec(CPDFSDK_Document* pTarget,const CFX_WideString& st rTargetName)
350 { 346 {
351 ASSERT(m_pEventHandler != NULL); 347 ASSERT(m_pEventHandler != NULL);
352 m_pEventHandler->OnMenu_Exec(pTarget, strTargetName); 348 m_pEventHandler->OnMenu_Exec(pTarget, strTargetName);
353 } 349 }
354 350
OLDNEW
« no previous file with comments | « fpdfsdk/src/fpdftext.cpp ('k') | fpdfsdk/src/javascript/JS_Runtime.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698