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

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

Issue 928803002: Set the view pointer as NULL after its xfa doc is released (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 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 "../../include/fsdk_define.h" 7 #include "../../include/fsdk_define.h"
8 #include "../../include/fpdfxfa/fpdfxfa_doc.h" 8 #include "../../include/fpdfxfa/fpdfxfa_doc.h"
9 #include "../../include/fpdfformfill.h" 9 #include "../../include/fpdfformfill.h"
10 #include "../../include/fsdk_mgr.h" 10 #include "../../include/fsdk_mgr.h"
11 #include "../../include/fpdfxfa/fpdfxfa_app.h" 11 #include "../../include/fpdfxfa/fpdfxfa_app.h"
12 #include "../../include/fpdfxfa/fpdfxfa_util.h" 12 #include "../../include/fpdfxfa/fpdfxfa_util.h"
13 #include "../../include/fpdfxfa/fpdfxfa_page.h" 13 #include "../../include/fpdfxfa/fpdfxfa_page.h"
14 #include "../../include/javascript/IJavaScript.h" 14 #include "../../include/javascript/IJavaScript.h"
15 15
16 16
17 17
18 #define IDS_XFA_StringMonth_April "April" 18 #define IDS_XFA_StringMonth_April "April"
Tom Sepez 2015/02/17 19:23:00 Unrelated: curious, what happened to January, Febr
19 #define IDS_XFA_StringMonth_May "May" 19 #define IDS_XFA_StringMonth_May "May"
20 #define IDS_XFA_StringMonth_June "June" 20 #define IDS_XFA_StringMonth_June "June"
21 #define IDS_XFA_StringMonth_July "July" 21 #define IDS_XFA_StringMonth_July "July"
22 #define IDS_XFA_StringMonth_Aug "August" 22 #define IDS_XFA_StringMonth_Aug "August"
23 #define IDS_XFA_StringMonth_Sept "September" 23 #define IDS_XFA_StringMonth_Sept "September"
24 #define IDS_XFA_StringMonth_Oct "October" 24 #define IDS_XFA_StringMonth_Oct "October"
25 #define IDS_XFA_StringMonth_Nov "November" 25 #define IDS_XFA_StringMonth_Nov "November"
26 #define IDS_XFA_StringMonth_Dec "December" 26 #define IDS_XFA_StringMonth_Dec "December"
27 #define IDS_XFA_String_Today "Today" 27 #define IDS_XFA_String_Today "Today"
28 #define IDS_XFA_ValidateLimit "Message limit exceeded. Remaining %d validation errors not reported." 28 #define IDS_XFA_ValidateLimit "Message limit exceeded. Remaining %d validation errors not reported."
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 m_pPDFDoc = NULL; 71 m_pPDFDoc = NULL;
72 } 72 }
73 if (m_pXFADoc) 73 if (m_pXFADoc)
74 { 74 {
75 IXFA_App* pApp = m_pApp->GetXFAApp(); 75 IXFA_App* pApp = m_pApp->GetXFAApp();
76 if (pApp) 76 if (pApp)
77 { 77 {
78 IXFA_DocHandler* pDocHandler = pApp->GetDocHandler(); 78 IXFA_DocHandler* pDocHandler = pApp->GetDocHandler();
79 if (pDocHandler) 79 if (pDocHandler)
80 { 80 {
81 pDocHandler->CloseDoc(m_pXFADoc); 81 pDocHandler->CloseDoc(m_pXFADoc);
Tom Sepez 2015/02/17 19:14:08 nit: can we make a helper method to do these 4 ste
82 pDocHandler->ReleaseDoc(m_pXFADoc); 82 pDocHandler->ReleaseDoc(m_pXFADoc);
83 m_pXFADoc = NULL; 83 m_pXFADoc = NULL;
84 m_pXFADocView = NULL;
84 } 85 }
85 } 86 }
86 } 87 }
87 88
88 if (m_pJSContext) 89 if (m_pJSContext)
89 { 90 {
90 if (m_pSDKDoc && m_pSDKDoc->GetEnv()) 91 if (m_pSDKDoc && m_pSDKDoc->GetEnv())
91 { 92 {
92 m_pSDKDoc->GetEnv()->GetJSRuntime()->ReleaseContext(m_pJ SContext); 93 m_pSDKDoc->GetEnv()->GetJSRuntime()->ReleaseContext(m_pJ SContext);
93 m_pJSContext = NULL; 94 m_pJSContext = NULL;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 IXFA_DocHandler* pDocHandler = pApp->GetDocHandler(); 126 IXFA_DocHandler* pDocHandler = pApp->GetDocHandler();
126 if (pDocHandler) 127 if (pDocHandler)
127 { 128 {
128 int iStatus = pDocHandler->StartLoad(m_pXFADoc); 129 int iStatus = pDocHandler->StartLoad(m_pXFADoc);
129 iStatus = pDocHandler->DoLoad(m_pXFADoc, NULL); 130 iStatus = pDocHandler->DoLoad(m_pXFADoc, NULL);
130 if (iStatus != 100) 131 if (iStatus != 100)
131 { 132 {
132 pDocHandler->CloseDoc(m_pXFADoc); 133 pDocHandler->CloseDoc(m_pXFADoc);
133 pDocHandler->ReleaseDoc(m_pXFADoc); 134 pDocHandler->ReleaseDoc(m_pXFADoc);
134 m_pXFADoc = NULL; 135 m_pXFADoc = NULL;
136 m_pXFADocView = NULL;
135 137
136 SetLastError(FPDF_ERR_XFALOAD); 138 SetLastError(FPDF_ERR_XFALOAD);
137 return FALSE; 139 return FALSE;
138 } 140 }
139 pDocHandler->StopLoad(m_pXFADoc); 141 pDocHandler->StopLoad(m_pXFADoc);
140 pDocHandler->SetJSERuntime(m_pXFADoc, m_pApp->Ge tJSERuntime()); 142 pDocHandler->SetJSERuntime(m_pXFADoc, m_pApp->Ge tJSERuntime());
141 143
142 if (pDocHandler->GetDocType(m_pXFADoc) == XFA_DO CTYPE_Dynamic) 144 if (pDocHandler->GetDocType(m_pXFADoc) == XFA_DO CTYPE_Dynamic)
143 m_iDocType = DOCTYPE_DYNIMIC_XFA; 145 m_iDocType = DOCTYPE_DYNIMIC_XFA;
144 else 146 else
145 m_iDocType = DOCTYPE_STATIC_XFA; 147 m_iDocType = DOCTYPE_STATIC_XFA;
146 148
147 m_pXFADocView = pDocHandler->CreateDocView(m_pXF ADoc, XFA_DOCVIEW_View); 149 m_pXFADocView = pDocHandler->CreateDocView(m_pXF ADoc, XFA_DOCVIEW_View);
148 FXSYS_assert(m_pXFADocView); 150 FXSYS_assert(m_pXFADocView);
149 151
150 if (m_pXFADocView->StartLayout() < 0) 152 if (m_pXFADocView->StartLayout() < 0)
151 { 153 {
152 pDocHandler->CloseDoc(m_pXFADoc); 154 pDocHandler->CloseDoc(m_pXFADoc);
153 pDocHandler->ReleaseDoc(m_pXFADoc); 155 pDocHandler->ReleaseDoc(m_pXFADoc);
154 m_pXFADoc = NULL; 156 m_pXFADoc = NULL;
157 m_pXFADocView = NULL;
155 158
156 SetLastError(FPDF_ERR_XFALAYOUT); 159 SetLastError(FPDF_ERR_XFALAYOUT);
157 return FALSE; 160 return FALSE;
158 } 161 }
159 else 162 else
160 { 163 {
161 m_pXFADocView->DoLayout(NULL); 164 m_pXFADocView->DoLayout(NULL);
162 m_pXFADocView->StopLayout(); 165 m_pXFADocView->StopLayout();
163 166
164 return TRUE; 167 return TRUE;
(...skipping 1302 matching lines...) Expand 10 before | Expand all | Expand 10 after
1467 } 1470 }
1468 1471
1469 return _GetHValueByName(szPropName, hValue, m_pSDKDoc->GetEnv()->GetJSRu ntime()); 1472 return _GetHValueByName(szPropName, hValue, m_pSDKDoc->GetEnv()->GetJSRu ntime());
1470 1473
1471 } 1474 }
1472 FX_BOOL CPDFXFA_Document::_GetHValueByName(FX_BSTR utf8Name, FXJSE_HVALUE hValue , IFXJS_Runtime* runTime) 1475 FX_BOOL CPDFXFA_Document::_GetHValueByName(FX_BSTR utf8Name, FXJSE_HVALUE hValue , IFXJS_Runtime* runTime)
1473 { 1476 {
1474 return runTime->GetHValueByName(utf8Name, hValue); 1477 return runTime->GetHValueByName(utf8Name, hValue);
1475 } 1478 }
1476 1479
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