Kaydet (Commit) 34700400 authored tarafından Michael Stahl's avatar Michael Stahl

vcl: fix resource management issue in WinSalLayout

Since commit 65a66d41 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
üst d421ba3b
......@@ -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
......
......@@ -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
......
......@@ -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
{
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment