[Libreoffice-commits] core.git: vcl/unx

Khaled Hosny khaledhosny at eglug.org
Wed May 9 10:13:56 UTC 2018


 vcl/unx/generic/glyphs/glyphcache.cxx |    7 -------
 1 file changed, 7 deletions(-)

New commits:
commit b0be0d419576c4ba2ad0f904592879a7736cbfaf
Author: Khaled Hosny <khaledhosny at eglug.org>
Date:   Tue May 8 22:21:07 2018 +0200

    Blind attempt to fix UBSAN error in FreetypeFont
    
    The only place that calls FreetypeFontInstance::SetFreetypeFont() is
    FreetypeFont::FreetypeFont() calling it with “this”:
    
        static_cast<FreetypeFontInstance*>(mpFontInstance)->SetFreetypeFont( this );
    
    So I don’t think we need to manage that FreetypeFont pointer, as it it
    is guaranteed to be valid as long as this FreetypeFontInstance is valid.
    
    Too many font classes and it is really hard to reason what is doing
    what…
    
    Change-Id: Iee50d2ecc4084116c13a2d2464594d6cffdcfcfe
    Reviewed-on: https://gerrit.libreoffice.org/54008
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/vcl/unx/generic/glyphs/glyphcache.cxx b/vcl/unx/generic/glyphs/glyphcache.cxx
index ac2eaf5498e3..cff473c9036c 100644
--- a/vcl/unx/generic/glyphs/glyphcache.cxx
+++ b/vcl/unx/generic/glyphs/glyphcache.cxx
@@ -357,18 +357,11 @@ void FreetypeFontInstance::SetFreetypeFont(FreetypeFont* p)
 {
     if (p == mpFreetypeFont)
         return;
-    if (mpFreetypeFont)
-        mpFreetypeFont->Release();
     mpFreetypeFont = p;
-    if (mpFreetypeFont)
-        mpFreetypeFont->AddRef();
 }
 
 FreetypeFontInstance::~FreetypeFontInstance()
 {
-    // TODO: remove the FreetypeFont here instead of in the GlyphCache
-    if (mpFreetypeFont)
-        mpFreetypeFont->Release();
 }
 
 static hb_blob_t* getFontTable(hb_face_t* /*face*/, hb_tag_t nTableTag, void* pUserData)


More information about the Libreoffice-commits mailing list