diff options
author | Cary Clark <caryclark@skia.org> | 2017-07-05 11:05:00 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-07-05 21:48:15 +0000 |
commit | ddf2418ba8e5d925909d7955ac22b33f37ccce44 (patch) | |
tree | 554cf2f5d122760bdc84506822e258de757e043a /core/fxge/ge/cfx_facecache.cpp | |
parent | 0ba3c6da16d4e90f0ad1fc9f326bf863860c0470 (diff) | |
download | pdfium-ddf2418ba8e5d925909d7955ac22b33f37ccce44.tar.xz |
typeface double deletechromium/3150
SkTypeface was doubly deleted at pdfium teardown
SkTypeface has two pointers but no owners.
Making the font cache an owner fixes the bug but
violates checkdeps rules. Let me know what to
do about that.
R=dsinclair@chromium.org,npm@chromium.org
Bug: 736133
Change-Id: I756a41258a5ac86e70139d7a587c5da9bb7a707b
Reviewed-on: https://pdfium-review.googlesource.com/7270
Reviewed-by: Nicolás Peña <npm@chromium.org>
Commit-Queue: Cary Clark <caryclark@google.com>
Diffstat (limited to 'core/fxge/ge/cfx_facecache.cpp')
-rw-r--r-- | core/fxge/ge/cfx_facecache.cpp | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/core/fxge/ge/cfx_facecache.cpp b/core/fxge/ge/cfx_facecache.cpp index 6049729089..e675e11510 100644 --- a/core/fxge/ge/cfx_facecache.cpp +++ b/core/fxge/ge/cfx_facecache.cpp @@ -89,9 +89,6 @@ CFX_FaceCache::CFX_FaceCache(FXFT_Face face) } CFX_FaceCache::~CFX_FaceCache() { -#if defined _SKIA_SUPPORT_ || _SKIA_SUPPORT_PATHS_ - SkSafeUnref(m_pTypeface.Get()); -#endif } std::unique_ptr<CFX_GlyphBitmap> CFX_FaceCache::RenderGlyph( @@ -358,19 +355,17 @@ const CFX_GlyphBitmap* CFX_FaceCache::LoadGlyphBitmap(const CFX_Font* pFont, #if defined _SKIA_SUPPORT_ || defined _SKIA_SUPPORT_PATHS_ CFX_TypeFace* CFX_FaceCache::GetDeviceCache(const CFX_Font* pFont) { if (!m_pTypeface) { - m_pTypeface = - SkTypeface::MakeFromStream( - new SkMemoryStream(pFont->GetFontData(), pFont->GetSize())) - .release(); + m_pTypeface = SkTypeface::MakeFromStream( + new SkMemoryStream(pFont->GetFontData(), pFont->GetSize())); } #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ if (!m_pTypeface) { sk_sp<SkFontMgr> customMgr(SkFontMgr_New_Custom_Empty()); - m_pTypeface = customMgr->createFromStream( - new SkMemoryStream(pFont->GetFontData(), pFont->GetSize())); + m_pTypeface.reset(customMgr->createFromStream( + new SkMemoryStream(pFont->GetFontData(), pFont->GetSize()))); } #endif - return m_pTypeface.Get(); + return m_pTypeface.get(); } #endif |