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

Side by Side Diff: xfa/fxfa/app/xfa_ffapp.cpp

Issue 2259823004: [XFA] Force destruction order of font managers. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: More resets Created 4 years, 4 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/fgas/font/fgas_stdfontmgr.cpp ('k') | xfa/fxfa/app/xfa_fontmgr.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 "xfa/fxfa/include/xfa_ffapp.h" 7 #include "xfa/fxfa/include/xfa_ffapp.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <utility> 10 #include <utility>
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 CXFA_TimeZoneProvider::Create(); 81 CXFA_TimeZoneProvider::Create();
82 } 82 }
83 83
84 CXFA_FFApp::~CXFA_FFApp() { 84 CXFA_FFApp::~CXFA_FFApp() {
85 if (m_pFWLApp) { 85 if (m_pFWLApp) {
86 m_pFWLApp->Finalize(); 86 m_pFWLApp->Finalize();
87 m_pFWLApp->Release(); 87 m_pFWLApp->Release();
88 } 88 }
89 89
90 CXFA_TimeZoneProvider::Destroy(); 90 CXFA_TimeZoneProvider::Destroy();
91
92 // The fonts stored in the font manager may have been created by the default
93 // font manager. The GEFont::LoadFont call takes the manager as a param and
94 // stores it internally. When you destroy the GEFont it tries to unregister
95 // from the font manager and if the default font manager was destroyed first
96 // get get a use-after-free. The m_pFWLTheme can try to cleanup a GEFont
97 // when it frees, so make sure it gets cleaned up first. That requires
98 // m_pFWLApp to be cleaned up as well.
99 //
100 // TODO(dsinclair): The GEFont should have the FontMgr as the pointer instead
101 // of the DEFFontMgr so this goes away. Bug 561.
102 m_pFWLApp.reset();
103 m_pFWLTheme.reset();
104 m_pFontMgr.reset();
105 m_pFDEFontMgr.reset();
Wei Li 2016/08/18 22:10:58 Can you just exchange the order of |m_pFDEFontMgr|
dsinclair 2016/08/23 13:59:43 Done.
91 } 106 }
92 107
93 CXFA_FFDocHandler* CXFA_FFApp::GetDocHandler() { 108 CXFA_FFDocHandler* CXFA_FFApp::GetDocHandler() {
94 if (!m_pDocHandler) 109 if (!m_pDocHandler)
95 m_pDocHandler.reset(new CXFA_FFDocHandler); 110 m_pDocHandler.reset(new CXFA_FFDocHandler);
96 return m_pDocHandler.get(); 111 return m_pDocHandler.get();
97 } 112 }
98 113
99 CXFA_FFDoc* CXFA_FFApp::CreateDoc(IXFA_DocProvider* pProvider, 114 CXFA_FFDoc* CXFA_FFApp::CreateDoc(IXFA_DocProvider* pProvider,
100 IFX_FileRead* pStream, 115 IFX_FileRead* pStream,
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 pDelegate->OnSetCapability(FWL_WGTMGR_DisableThread | 164 pDelegate->OnSetCapability(FWL_WGTMGR_DisableThread |
150 FWL_WGTMGR_DisableForm); 165 FWL_WGTMGR_DisableForm);
151 m_pWidgetMgrDelegate = pDelegate; 166 m_pWidgetMgrDelegate = pDelegate;
152 } 167 }
153 return m_pAdapterWidgetMgr.get(); 168 return m_pAdapterWidgetMgr.get();
154 } 169 }
155 170
156 IFWL_AdapterTimerMgr* CXFA_FFApp::GetTimerMgr() const { 171 IFWL_AdapterTimerMgr* CXFA_FFApp::GetTimerMgr() const {
157 return m_pProvider->GetTimerMgr(); 172 return m_pProvider->GetTimerMgr();
158 } 173 }
OLDNEW
« no previous file with comments | « xfa/fgas/font/fgas_stdfontmgr.cpp ('k') | xfa/fxfa/app/xfa_fontmgr.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698