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

Side by Side Diff: fpdfsdk/cpdfsdk_formfillenvironment.cpp

Issue 2408163003: Fixup formfiller cleanup (Closed)
Patch Set: Make sure annotation handler manager is destroyed at the right time. Created 4 years, 2 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 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 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/cpdfsdk_formfillenvironment.h" 7 #include "fpdfsdk/cpdfsdk_formfillenvironment.h"
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 21 matching lines...) Expand all
32 32
33 CPDFSDK_FormFillEnvironment::CPDFSDK_FormFillEnvironment( 33 CPDFSDK_FormFillEnvironment::CPDFSDK_FormFillEnvironment(
34 UnderlyingDocumentType* pDoc, 34 UnderlyingDocumentType* pDoc,
35 FPDF_FORMFILLINFO* pFFinfo) 35 FPDF_FORMFILLINFO* pFFinfo)
36 : m_pInfo(pFFinfo), 36 : m_pInfo(pFFinfo),
37 m_pSDKDoc(new CPDFSDK_Document(pDoc, this)), 37 m_pSDKDoc(new CPDFSDK_Document(pDoc, this)),
38 m_pUnderlyingDoc(pDoc), 38 m_pUnderlyingDoc(pDoc),
39 m_pSysHandler(new CFX_SystemHandler(this)) {} 39 m_pSysHandler(new CFX_SystemHandler(this)) {}
40 40
41 CPDFSDK_FormFillEnvironment::~CPDFSDK_FormFillEnvironment() { 41 CPDFSDK_FormFillEnvironment::~CPDFSDK_FormFillEnvironment() {
42 // CPDFSDK_AnnotHandlerMgr will try to access the form fill environment
43 // when it cleans up the CFFL_InteractiveFormFiller. So, we must make sure
44 // it is cleaned up before the CFFL_InteractiveFormFiller.
Lei Zhang 2016/10/11 20:54:52 Refer to |m_pFormFiller| explicitly here?
dsinclair 2016/10/11 21:01:59 Done.
45 m_pAnnotHandlerMgr.reset();
46
47 // Must destroy the |CFFL_InteractiveFormFiller| before the environment
Lei Zhang 2016/10/11 20:54:52 |m_pFormFiller|
dsinclair 2016/10/11 21:01:59 Done.
48 // because any created form widgets hold a pointer to the environment.
49 // Those widgets may call things like |KillTimer| as they are shutdown.
Lei Zhang 2016/10/11 20:54:52 KillTimer() and no double space after.
dsinclair 2016/10/11 21:01:59 Done.
50 m_pFormFiller.reset();
51
42 #ifdef PDF_ENABLE_XFA 52 #ifdef PDF_ENABLE_XFA
43 CPDFXFA_App* pProvider = CPDFXFA_App::GetInstance(); 53 CPDFXFA_App* pProvider = CPDFXFA_App::GetInstance();
44 if (pProvider->m_pEnvList.GetSize() == 0) 54 if (pProvider->m_pEnvList.GetSize() == 0)
45 pProvider->SetJavaScriptInitialized(FALSE); 55 pProvider->SetJavaScriptInitialized(FALSE);
46 #endif // PDF_ENABLE_XFA 56 #endif // PDF_ENABLE_XFA
47 if (m_pInfo && m_pInfo->Release) 57 if (m_pInfo && m_pInfo->Release)
48 m_pInfo->Release(m_pInfo); 58 m_pInfo->Release(m_pInfo);
49 } 59 }
50 60
51 int CPDFSDK_FormFillEnvironment::JS_appAlert(const FX_WCHAR* Msg, 61 int CPDFSDK_FormFillEnvironment::JS_appAlert(const FX_WCHAR* Msg,
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 delete[] pbuff; 555 delete[] pbuff;
546 return wsRet; 556 return wsRet;
547 } 557 }
548 558
549 void CPDFSDK_FormFillEnvironment::PageEvent(int iPageCount, 559 void CPDFSDK_FormFillEnvironment::PageEvent(int iPageCount,
550 uint32_t dwEventType) const { 560 uint32_t dwEventType) const {
551 if (m_pInfo && m_pInfo->FFI_PageEvent) 561 if (m_pInfo && m_pInfo->FFI_PageEvent)
552 m_pInfo->FFI_PageEvent(m_pInfo, iPageCount, dwEventType); 562 m_pInfo->FFI_PageEvent(m_pInfo, iPageCount, dwEventType);
553 } 563 }
554 #endif // PDF_ENABLE_XFA 564 #endif // PDF_ENABLE_XFA
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