From ece78514e9a8707181cb3363190fff6df9096bc3 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 10 Jun 2002 20:24:29 +0000 Subject: Don't leak raw_metrics and don't copy refcounts. (#84533) * pango/pango-fontset.c (pango_fontset_real_get_metrics): Don't leak raw_metrics and don't copy refcounts. (#84533) --- pango/pango-fontset.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'pango') diff --git a/pango/pango-fontset.c b/pango/pango-fontset.c index 761f1c49..7ba883d1 100644 --- a/pango/pango-fontset.c +++ b/pango/pango-fontset.c @@ -133,21 +133,23 @@ pango_fontset_real_get_metrics (PangoFontset *fontset) { raw_metrics = pango_font_get_metrics (font, language); g_hash_table_insert (fonts_seen, font, font); - + if (count == 0) { - *metrics = *raw_metrics; + metrics->ascent = raw_metrics->ascent; + metrics->descent = raw_metrics->descent; metrics->approximate_char_width = raw_metrics->approximate_char_width; metrics->approximate_digit_width = raw_metrics->approximate_digit_width; } else - { + { metrics->ascent = MAX (metrics->ascent, raw_metrics->ascent); metrics->descent = MAX (metrics->descent, raw_metrics->descent); metrics->approximate_char_width += raw_metrics->approximate_char_width; metrics->approximate_digit_width += raw_metrics->approximate_digit_width; } count++; + pango_font_metrics_unref (raw_metrics); } else g_object_unref (font); -- cgit v1.2.1