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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fxfa/app/xfa_ffapp.cpp
diff --git a/xfa/fxfa/app/xfa_ffapp.cpp b/xfa/fxfa/app/xfa_ffapp.cpp
index 18e2d76552cf80275617ac045a969d16aa0238ec..d5259a2f5776c09722af1187634e44423f4145fe 100644
--- a/xfa/fxfa/app/xfa_ffapp.cpp
+++ b/xfa/fxfa/app/xfa_ffapp.cpp
@@ -88,6 +88,21 @@ CXFA_FFApp::~CXFA_FFApp() {
}
CXFA_TimeZoneProvider::Destroy();
+
+ // The fonts stored in the font manager may have been created by the default
+ // font manager. The GEFont::LoadFont call takes the manager as a param and
+ // stores it internally. When you destroy the GEFont it tries to unregister
+ // from the font manager and if the default font manager was destroyed first
+ // get get a use-after-free. The m_pFWLTheme can try to cleanup a GEFont
+ // when it frees, so make sure it gets cleaned up first. That requires
+ // m_pFWLApp to be cleaned up as well.
+ //
+ // TODO(dsinclair): The GEFont should have the FontMgr as the pointer instead
+ // of the DEFFontMgr so this goes away. Bug 561.
+ m_pFWLApp.reset();
+ m_pFWLTheme.reset();
+ m_pFontMgr.reset();
+ 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.
}
CXFA_FFDocHandler* CXFA_FFApp::GetDocHandler() {
« 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