OLD | NEW |
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 #ifndef XFA_FXFA_INCLUDE_XFA_FFAPP_H_ | 7 #ifndef XFA_FXFA_INCLUDE_XFA_FFAPP_H_ |
8 #define XFA_FXFA_INCLUDE_XFA_FFAPP_H_ | 8 #define XFA_FXFA_INCLUDE_XFA_FFAPP_H_ |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 IXFA_AppProvider* GetAppProvider() const { return m_pProvider; } | 56 IXFA_AppProvider* GetAppProvider() const { return m_pProvider; } |
57 IFWL_AdapterTimerMgr* GetTimerMgr() const; | 57 IFWL_AdapterTimerMgr* GetTimerMgr() const; |
58 CXFA_FontMgr* GetXFAFontMgr() const; | 58 CXFA_FontMgr* GetXFAFontMgr() const; |
59 CFWL_WidgetMgrDelegate* GetWidgetMgrDelegate() const { | 59 CFWL_WidgetMgrDelegate* GetWidgetMgrDelegate() const { |
60 return m_pWidgetMgrDelegate; | 60 return m_pWidgetMgrDelegate; |
61 } | 61 } |
62 | 62 |
63 protected: | 63 protected: |
64 std::unique_ptr<CXFA_FFDocHandler> m_pDocHandler; | 64 std::unique_ptr<CXFA_FFDocHandler> m_pDocHandler; |
65 IXFA_AppProvider* const m_pProvider; | 65 IXFA_AppProvider* const m_pProvider; |
| 66 |
| 67 // The fonts stored in the font manager may have been created by the default |
| 68 // font manager. The GEFont::LoadFont call takes the manager as a param and |
| 69 // stores it internally. When you destroy the GEFont it tries to unregister |
| 70 // from the font manager and if the default font manager was destroyed first |
| 71 // get get a use-after-free. The m_pFWLTheme can try to cleanup a GEFont |
| 72 // when it frees, so make sure it gets cleaned up first. That requires |
| 73 // m_pFWLApp to be cleaned up as well. |
| 74 // |
| 75 // TODO(dsinclair): The GEFont should have the FontMgr as the pointer instead |
| 76 // of the DEFFontMgr so this goes away. Bug 561. |
| 77 std::unique_ptr<IFGAS_FontMgr> m_pFDEFontMgr; |
66 std::unique_ptr<CXFA_FontMgr> m_pFontMgr; | 78 std::unique_ptr<CXFA_FontMgr> m_pFontMgr; |
| 79 |
67 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ | 80 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ |
68 std::unique_ptr<CFX_FontSourceEnum_File> m_pFontSource; | 81 std::unique_ptr<CFX_FontSourceEnum_File> m_pFontSource; |
69 #endif | 82 #endif |
70 std::unique_ptr<CXFA_FWLAdapterWidgetMgr> m_pAdapterWidgetMgr; | 83 std::unique_ptr<CXFA_FWLAdapterWidgetMgr> m_pAdapterWidgetMgr; |
71 CFWL_WidgetMgrDelegate* m_pWidgetMgrDelegate; // not owned. | 84 CFWL_WidgetMgrDelegate* m_pWidgetMgrDelegate; // not owned. |
72 std::unique_ptr<IFGAS_FontMgr> m_pFDEFontMgr; | 85 |
73 // |m_pFWLApp| has to be released first, then |m_pFWLTheme| since the former | 86 // |m_pFWLApp| has to be released first, then |m_pFWLTheme| since the former |
74 // may refers to theme manager and the latter refers to font manager. | 87 // may refers to theme manager and the latter refers to font manager. |
75 std::unique_ptr<CXFA_FWLTheme> m_pFWLTheme; | 88 std::unique_ptr<CXFA_FWLTheme> m_pFWLTheme; |
76 std::unique_ptr<IFWL_App> m_pFWLApp; | 89 std::unique_ptr<IFWL_App> m_pFWLApp; |
77 }; | 90 }; |
78 | 91 |
79 #endif // XFA_FXFA_INCLUDE_XFA_FFAPP_H_ | 92 #endif // XFA_FXFA_INCLUDE_XFA_FFAPP_H_ |
OLD | NEW |