From 7e7c2a671539238615aa8514a5ca0c5ab64b61b5 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 30 Mar 2007 11:50:46 +0000 Subject: [PATCH] fix PangoFontMetrics leak in GetCharHeight() (bug 1691180) [backport from HEAD] git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@45129 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/dcclient.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gtk/dcclient.cpp b/src/gtk/dcclient.cpp index c79e4175d6..a3681ed4d0 100644 --- a/src/gtk/dcclient.cpp +++ b/src/gtk/dcclient.cpp @@ -1830,7 +1830,12 @@ wxCoord wxWindowDC::GetCharWidth() const wxCoord wxWindowDC::GetCharHeight() const { PangoFontMetrics *metrics = pango_context_get_metrics (m_context, m_fontdesc, pango_context_get_language(m_context)); - return PANGO_PIXELS (pango_font_metrics_get_descent (metrics) + pango_font_metrics_get_ascent (metrics)); + wxCHECK_MSG( metrics, -1, _T("failed to get pango font metrics") ); + + wxCoord h = PANGO_PIXELS (pango_font_metrics_get_descent (metrics) + + pango_font_metrics_get_ascent (metrics)); + pango_font_metrics_unref (metrics); + return h; } void wxWindowDC::Clear()