vcl/inc/outfont.hxx | 2 ++ vcl/source/outdev/font.cxx | 5 ++++- vcl/win/source/gdi/winlayout.cxx | 10 +++++++++- vcl/win/source/gdi/winlayout.hxx | 1 + 4 files changed, 16 insertions(+), 2 deletions(-)
New commits: commit 34700400247e378e074ce4164ab2809edb092201 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. Change-Id: Ic4bf984ea9fd70de9fa95ca964ae12d95d47d5bf diff --git a/vcl/inc/outfont.hxx b/vcl/inc/outfont.hxx index dd6c456..bc5e65c 100644 --- a/vcl/inc/outfont.hxx +++ b/vcl/inc/outfont.hxx @@ -36,6 +36,7 @@ class PhysicalFontFamily; class ImplGetDevFontList; class ImplGetDevSizeList; class ImplFontEntry; +class ImplFontCache; class ImplPreMatchFontSubstitution; class ImplGlyphFallbackFontSubstitution; class FontSelectPattern; @@ -223,6 +224,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 5c1d00d..b673f91 100644 --- a/vcl/source/outdev/font.cxx +++ b/vcl/source/outdev/font.cxx @@ -980,7 +980,8 @@ vcl::Font OutputDevice::GetDefaultFont( DefaultFontType nType, LanguageType eLan } ImplFontEntry::ImplFontEntry( const FontSelectPattern& rFontSelData ) - : maFontSelData( rFontSelData ) + : m_pFontCache(nullptr) + , maFontSelData( rFontSelData ) , maMetric( rFontSelData ) , mpConversion( NULL ) , mnLineHeight( 0 ) @@ -997,6 +998,7 @@ ImplFontEntry::ImplFontEntry( const FontSelectPattern& rFontSelData ) ImplFontEntry::~ImplFontEntry() { delete mpUnicodeFallbackList; + m_pFontCache = nullptr; } size_t ImplFontEntry::GFBCacheKey_Hash::operator()( const GFBCacheKey& rData ) const @@ -1332,6 +1334,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 19aa22f..8d5d8bd 100644 --- a/vcl/win/source/gdi/winlayout.cxx +++ b/vcl/win/source/gdi/winlayout.cxx @@ -29,6 +29,7 @@ #include <vcl/opengl/OpenGLHelper.hxx> #include <win/salgdi.h> #include <win/saldata.hxx> +#include <outdev.h> #include "sft.hxx" #include "sallayout.hxx" @@ -454,7 +455,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 { diff --git a/vcl/win/source/gdi/winlayout.hxx b/vcl/win/source/gdi/winlayout.hxx index 8855e37..d558d4cc 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 SAL_OVERRIDE; void SetFontScale( float f ) { mfFontScale = f; } HFONT DisableFontScaling() const; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits