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

Side by Side Diff: fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp

Issue 1667643002: Fix a crashier in CPDFSDK_Document::GetPageView() (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 4 years, 10 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 | « no previous file | no next file » | 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 "fpdfsdk/include/fsdk_define.h" 7 #include "fpdfsdk/include/fsdk_define.h"
8 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h" 8 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h"
9 #include "fpdfsdk/include/fsdk_mgr.h" 9 #include "fpdfsdk/include/fsdk_mgr.h"
10 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_app.h" 10 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_app.h"
(...skipping 27 matching lines...) Expand all
38 : m_iDocType(DOCTYPE_PDF), 38 : m_iDocType(DOCTYPE_PDF),
39 m_pPDFDoc(pPDFDoc), 39 m_pPDFDoc(pPDFDoc),
40 m_pSDKDoc(nullptr), 40 m_pSDKDoc(nullptr),
41 m_pXFADoc(nullptr), 41 m_pXFADoc(nullptr),
42 m_pXFADocView(nullptr), 42 m_pXFADocView(nullptr),
43 m_pApp(pProvider), 43 m_pApp(pProvider),
44 m_pJSContext(nullptr) { 44 m_pJSContext(nullptr) {
45 } 45 }
46 46
47 CPDFXFA_Document::~CPDFXFA_Document() { 47 CPDFXFA_Document::~CPDFXFA_Document() {
48 if (m_pJSContext && m_pSDKDoc && m_pSDKDoc->GetEnv())
49 m_pSDKDoc->GetEnv()->GetJSRuntime()->ReleaseContext(m_pJSContext);
50
51 delete m_pSDKDoc;
52
53 if (m_pPDFDoc) {
54 CPDF_Parser* pParser = m_pPDFDoc->GetParser();
55 if (pParser)
56 delete pParser;
57 else
58 delete m_pPDFDoc;
59 }
60 if (m_pXFADoc) { 48 if (m_pXFADoc) {
61 IXFA_App* pApp = m_pApp->GetXFAApp(); 49 IXFA_App* pApp = m_pApp->GetXFAApp();
62 if (pApp) { 50 if (pApp) {
63 IXFA_DocHandler* pDocHandler = pApp->GetDocHandler(); 51 IXFA_DocHandler* pDocHandler = pApp->GetDocHandler();
64 if (pDocHandler) { 52 if (pDocHandler) {
65 CloseXFADoc(pDocHandler); 53 CloseXFADoc(pDocHandler);
66 } 54 }
67 } 55 }
68 delete m_pXFADoc; 56 delete m_pXFADoc;
57 m_pXFADoc = nullptr;
Tom Sepez 2016/02/03 18:02:49 These are always worrisome; if the correct operati
58 }
59 if (m_pJSContext && m_pSDKDoc && m_pSDKDoc->GetEnv())
60 m_pSDKDoc->GetEnv()->GetJSRuntime()->ReleaseContext(m_pJSContext);
61 delete m_pSDKDoc;
62 m_pSDKDoc = nullptr;
63 if (m_pPDFDoc) {
64 CPDF_Parser* pParser = m_pPDFDoc->GetParser();
65 if (pParser)
66 delete pParser;
67 else
68 delete m_pPDFDoc;
69 } 69 }
70 } 70 }
71 71
72 FX_BOOL CPDFXFA_Document::LoadXFADoc() { 72 FX_BOOL CPDFXFA_Document::LoadXFADoc() {
73 if (!m_pPDFDoc) 73 if (!m_pPDFDoc)
74 return FALSE; 74 return FALSE;
75 75
76 m_XFAPageList.RemoveAll(); 76 m_XFAPageList.RemoveAll();
77 77
78 IXFA_App* pApp = m_pApp->GetXFAApp(); 78 IXFA_App* pApp = m_pApp->GetXFAApp();
(...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after
1252 } 1252 }
1253 1253
1254 return _GetHValueByName(szPropName, hValue, 1254 return _GetHValueByName(szPropName, hValue,
1255 m_pSDKDoc->GetEnv()->GetJSRuntime()); 1255 m_pSDKDoc->GetEnv()->GetJSRuntime());
1256 } 1256 }
1257 FX_BOOL CPDFXFA_Document::_GetHValueByName(const CFX_ByteStringC& utf8Name, 1257 FX_BOOL CPDFXFA_Document::_GetHValueByName(const CFX_ByteStringC& utf8Name,
1258 FXJSE_HVALUE hValue, 1258 FXJSE_HVALUE hValue,
1259 IJS_Runtime* runTime) { 1259 IJS_Runtime* runTime) {
1260 return runTime->GetHValueByName(utf8Name, hValue); 1260 return runTime->GetHValueByName(utf8Name, hValue);
1261 } 1261 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698