vcl/inc/outfont.hxx | 2 ++ vcl/source/outdev/font.cxx | 5 ++++- vcl/win/source/gdi/winlayout.cxx | 9 ++++++++- vcl/win/source/gdi/winlayout.hxx | 1 + 4 files changed, 15 insertions(+), 2 deletions(-)
New commits: commit 4176d495dbca1da3316d9e3ac370ac5f2f046b1c Author: Michael Stahl <mst...@redhat.com> Date: Fri Aug 28 18:37:37 2015 +0200 vcl: fix resource management issue in WinSalLayout Since commit 65a66d41fd0e13d0aad9df935091b731b4af650a the sd_exports_test crashes on Windows in UniscribeLayout because it uses a ImplFontEntry that has been removed from the font cache. Tweak the refcount in WinLayout so it will be valid. (cherry picked from commit 34700400247e378e074ce4164ab2809edb092201) Change-Id: Ic4bf984ea9fd70de9fa95ca964ae12d95d47d5bf Reviewed-on: https://gerrit.libreoffice.org/18120 Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/vcl/inc/outfont.hxx b/vcl/inc/outfont.hxx index 0f28657..adca1cd 100644 --- a/vcl/inc/outfont.hxx +++ b/vcl/inc/outfont.hxx @@ -35,6 +35,7 @@ class PhysicalFontFamily; class ImplGetDevFontList; class ImplGetDevSizeList; class ImplFontEntry; +class ImplFontCache; class ImplPreMatchFontSubstitution; class ImplGlyphFallbackFontSubstitution; class FontSelectPattern; @@ -226,6 +227,7 @@ public: virtual ~ImplFontEntry(); public: // TODO: make data members private + ImplFontCache * m_pFontCache; FontSelectPattern maFontSelData; // FontSelectionData ImplFontMetricData maMetric; // Font Metric const ConvertChar* mpConversion; // used e.g. for StarBats->StarSymbol diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx index 068b2bb..6e46b80 100644 --- a/vcl/source/outdev/font.cxx +++ b/vcl/source/outdev/font.cxx @@ -951,7 +951,8 @@ Font OutputDevice::GetDefaultFont( sal_uInt16 nType, LanguageType eLang, } ImplFontEntry::ImplFontEntry( const FontSelectPattern& rFontSelData ) - : maFontSelData( rFontSelData ) + : m_pFontCache(nullptr) + , maFontSelData( rFontSelData ) , maMetric( rFontSelData ) , mpConversion( NULL ) , mnLineHeight( 0 ) @@ -968,6 +969,7 @@ ImplFontEntry::ImplFontEntry( const FontSelectPattern& rFontSelData ) ImplFontEntry::~ImplFontEntry() { delete mpUnicodeFallbackList; + m_pFontCache = nullptr; } size_t ImplFontEntry::GFBCacheKey_Hash::operator()( const GFBCacheKey& rData ) const @@ -1303,6 +1305,7 @@ ImplFontEntry* ImplFontCache::GetFontEntry( PhysicalFontCollection* pFontList, { // create a new logical font instance from this physical font face pEntry = pFontData->CreateFontInstance( aFontSelData ); + pEntry->m_pFontCache = this; // if we're subtituting from or to a symbol font we may need a symbol // conversion table diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx index 4a147b0..d010985 100644 --- a/vcl/win/source/gdi/winlayout.cxx +++ b/vcl/win/source/gdi/winlayout.cxx @@ -27,6 +27,7 @@ #include <vcl/opengl/OpenGLHelper.hxx> #include <win/salgdi.h> #include <win/saldata.hxx> +#include <outdev.h> #include "sft.hxx" #include "sallayout.hxx" @@ -113,8 +114,14 @@ WinLayout::WinLayout(HDC hDC, const ImplWinFontData& rWFD, ImplWinFontEntry& rWF mrWinFontData( rWFD ), mrWinFontEntry(rWFE), mbUseOpenGL(bUseOpenGL) -{} +{ + ++mrWinFontEntry.mnRefCount; // keep it alive +} +WinLayout::~WinLayout() +{ + mrWinFontEntry.m_pFontCache->Release(&mrWinFontEntry); +} void WinLayout::InitFont() const { ::SelectObject( mhDC, mhFont ); diff --git a/vcl/win/source/gdi/winlayout.hxx b/vcl/win/source/gdi/winlayout.hxx index 7847665..e362f5a 100644 --- a/vcl/win/source/gdi/winlayout.hxx +++ b/vcl/win/source/gdi/winlayout.hxx @@ -41,6 +41,7 @@ class WinLayout : public SalLayout { public: WinLayout(HDC, const ImplWinFontData&, ImplWinFontEntry&, bool bUseOpenGL); + virtual ~WinLayout(); virtual void InitFont() const; void SetFontScale( float f ) { mfFontScale = f; } HFONT DisableFontScaling( void) const;
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits