diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-09-11 14:16:05 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-10-01 07:22:31 +0000 |
commit | 5aceca0f5bf25d535c33a726d698777322b378d7 (patch) | |
tree | 9704460747e4f04c7b2fbb5acf511ff4f013319f | |
parent | 50eac342603ca08d808f53dc9a32bb9d1dfba372 (diff) |
server font dtor always calls ReleaseFaceFT
therefore we must always call GetFaceFT in the ctor
and not return early *before* calling GetFaceFT which
could happen in case of inane font size requests, i.e.
if( (mnWidth < 0) || (mfStretch > +64.0) || (mfStretch < -64.0) )
valgrind+bff
Change-Id: If22f8f7ff6aaed3ffa9eec68630da8601dfd5cae
(cherry picked from commit 884229ed3ee2f84eb052c866e22bdb242a385788)
Reviewed-on: https://gerrit.libreoffice.org/11400
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r-- | vcl/generic/glyphs/gcach_ftyp.cxx | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/vcl/generic/glyphs/gcach_ftyp.cxx b/vcl/generic/glyphs/gcach_ftyp.cxx index 47adb0929535..3978f021862f 100644 --- a/vcl/generic/glyphs/gcach_ftyp.cxx +++ b/vcl/generic/glyphs/gcach_ftyp.cxx @@ -488,6 +488,10 @@ ServerFont::ServerFont( const FontSelectPattern& rFSD, FtFontInfo* pFI ) // it becomes reponsible for the ServerFont instantiation ((ImplServerFontEntry*)rFSD.mpFontEntry)->SetServerFont( this ); + maFaceFT = pFI->GetFaceFT(); + if( !maFaceFT ) + return; + if( rFSD.mnOrientation != 0 ) { const double dRad = rFSD.mnOrientation * ( F_2PI / 3600.0 ); @@ -504,10 +508,6 @@ ServerFont::ServerFont( const FontSelectPattern& rFSD, FtFontInfo* pFI ) if( (mnWidth < 0) || (mfStretch > +64.0) || (mfStretch < -64.0) ) return; - maFaceFT = pFI->GetFaceFT(); - if( !maFaceFT ) - return; - FT_New_Size( maFaceFT, &maSizeFT ); FT_Activate_Size( maSizeFT ); FT_Error rc = FT_Set_Pixel_Sizes( maFaceFT, mnWidth, rFSD.mnHeight ); @@ -627,8 +627,7 @@ bool ServerFont::TestFont() const ServerFont::~ServerFont() { - if( mpLayoutEngine ) - delete mpLayoutEngine; + delete mpLayoutEngine; if( maSizeFT ) FT_Done_Size( maSizeFT ); |