summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Hosken <martin_hosken@sil.org>2011-03-08 11:45:16 +0700
committerMartin Hosken <martin_hosken@sil.org>2011-03-10 22:40:13 +0700
commit8e1679399097ad30091decd6eff000adc01f8e7e (patch)
treeb1e73ad5bcf52e6b140109c7b314a2671df20667
parentd83e115bae521fcf193978496d62dbc677a1d6ef (diff)
Attempt to fix winlayout memory leak
-rw-r--r--vcl/inc/vcl/graphite_layout.hxx5
-rw-r--r--vcl/source/glyphs/graphite_features.cxx6
-rw-r--r--vcl/win/source/gdi/winlayout.cxx1
3 files changed, 6 insertions, 6 deletions
diff --git a/vcl/inc/vcl/graphite_layout.hxx b/vcl/inc/vcl/graphite_layout.hxx
index 2da56addc1e3..de39ba36cdbc 100644
--- a/vcl/inc/vcl/graphite_layout.hxx
+++ b/vcl/inc/vcl/graphite_layout.hxx
@@ -81,6 +81,8 @@ public:
};
void addFont(int ppm, gr_font * pFont)
{
+ if (m_fonts[ppm])
+ gr_font_destroy(m_fonts[ppm]);
m_fonts[ppm] = pFont;
}
private:
@@ -107,7 +109,7 @@ public:
private:
const gr_face * mpFace; // not owned by layout
- gr_font * mpFont; // owned by layout
+ gr_font * mpFont; // not owned by layout
int mnSegCharOffset; // relative to ImplLayoutArgs::mpStr
long mnWidth;
std::vector<int> mvChar2BaseGlyph;
@@ -150,6 +152,7 @@ public:
virtual ~GraphiteLayout() throw();
void SetFont(gr_font * pFont) { mpFont = pFont; }
+ gr_font * GetFont() { return mpFont; }
void SetFeatures(grutils::GrFeatureParser * aFeature) { mpFeatures = aFeature; }
void SetFontScale(float s) { mfScaling = s; };
virtual sal_GlyphId getKashidaGlyph(int & width) = 0;
diff --git a/vcl/source/glyphs/graphite_features.cxx b/vcl/source/glyphs/graphite_features.cxx
index 3be036987865..c5b578f4cc97 100644
--- a/vcl/source/glyphs/graphite_features.cxx
+++ b/vcl/source/glyphs/graphite_features.cxx
@@ -161,7 +161,7 @@ void GrFeatureParser::setLang(const gr_face * pFace, const rtl::OString & lang)
{
FeatId aLang;
aLang.num = 0;
- if (lang.getLength() > 2)
+ if (lang.getLength() >= 2)
{
for (sal_Int32 i = 0; i < lang.getLength() && i < 3; i++)
{
@@ -194,17 +194,13 @@ void GrFeatureParser::setLang(const gr_face * pFace, const rtl::OString & lang)
if (i != gr_face_n_languages(pFace))
{
if (mpSettings)
- {
gr_featureval_destroy(mpSettings);
- }
mpSettings = gr_face_featureval_for_lang(pFace, maLang.num);
mnHash = maLang.num;
}
}
if (!mpSettings)
- {
mpSettings = gr_face_featureval_for_lang(pFace, 0);
- }
}
GrFeatureParser::~GrFeatureParser()
diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx
index 761bd5487799..d378ac5f3fe7 100644
--- a/vcl/win/source/gdi/winlayout.cxx
+++ b/vcl/win/source/gdi/winlayout.cxx
@@ -2805,6 +2805,7 @@ private:
public:
GraphiteWinLayout(HDC hDC, const ImplWinFontData& rWFD, ImplWinFontEntry& rWFE);
+ ~GraphiteWinLayout() { gr_font_destroy(maImpl.getFont()); }
// used by upper layers
virtual bool LayoutText( ImplLayoutArgs& ); // first step of layout
virtual void AdjustLayout( ImplLayoutArgs& ); // adjusting after fallback etc.