diff options
author | Behdad Esfahbod <behdad@gnome.org> | 2009-01-02 07:00:36 +0000 |
---|---|---|
committer | Behdad Esfahbod <behdad@src.gnome.org> | 2009-01-02 07:00:36 +0000 |
commit | 50d61fa3b2f74758be0ee234861c4ad20f2d2294 (patch) | |
tree | 7d12950967fc1a4d28ae9e8d9f8fa713154408fd | |
parent | 3ce892f3420e078b8a95cd0f60290c83dfb5191f (diff) | |
download | pango-50d61fa3b2f74758be0ee234861c4ad20f2d2294.tar.gz |
Fix possible reference leak when fallback is disabled.
2009-01-02 Behdad Esfahbod <behdad@gnome.org>
* pango/pango-context.c (shaper_font_element_destroy),
(get_shaper_font_cache), (shaper_font_cache_insert),
(get_shaper_and_font_foreach), (itemize_state_process_run):
Fix possible reference leak when fallback is disabled.
svn path=/trunk/; revision=2774
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | pango/pango-context.c | 13 |
2 files changed, 15 insertions, 5 deletions
@@ -1,3 +1,10 @@ +2009-01-02 Behdad Esfahbod <behdad@gnome.org> + + * pango/pango-context.c (shaper_font_element_destroy), + (get_shaper_font_cache), (shaper_font_cache_insert), + (get_shaper_and_font_foreach), (itemize_state_process_run): + Fix possible reference leak when fallback is disabled. + 2008-12-26 Behdad Esfahbod <behdad@gnome.org> Bug 565644 – Maybe pango_font_descriptions_free is deprecated diff --git a/pango/pango-context.c b/pango/pango-context.c index f6cc2b75..4ede1ad4 100644 --- a/pango/pango-context.c +++ b/pango/pango-context.c @@ -577,6 +577,8 @@ shaper_font_cache_destroy (ShaperFontCache *cache) static void shaper_font_element_destroy (ShaperFontElement *element) { + if (element->shape_engine) + g_object_unref (element->shape_engine); if (element->font) g_object_unref (element->font); g_slice_free (ShaperFontElement, element); @@ -588,7 +590,7 @@ get_shaper_font_cache (PangoFontset *fontset) ShaperFontCache *cache; static GQuark cache_quark = 0; - if (!cache_quark) + if (G_UNLIKELY (!cache_quark)) cache_quark = g_quark_from_static_string ("pango-shaper-font-cache"); cache = g_object_get_qdata (G_OBJECT (fontset), cache_quark); @@ -632,8 +634,8 @@ shaper_font_cache_insert (ShaperFontCache *cache, PangoFont *font) { ShaperFontElement *element = g_slice_new (ShaperFontElement); - element->shape_engine = shape_engine; - element->font = font; + element->shape_engine = shape_engine ? g_object_ref (shape_engine) : NULL; + element->font = font ? g_object_ref (font) : NULL; g_hash_table_insert (cache->hash, GUINT_TO_POINTER (wc), element); } @@ -1075,7 +1077,7 @@ get_shaper_and_font_foreach (PangoFontset *fontset G_GNUC_UNUSED, if (level != PANGO_COVERAGE_NONE) { info->shape_engine = engine; - info->font = g_object_ref (font); + info->font = font; return TRUE; } } @@ -1384,7 +1386,8 @@ itemize_state_process_run (ItemizeState *state) else what = "nothing (oops!)"; - g_warning ("failed to find shape engine, expect ugly output. engine-type='%s', script='%s'", + g_warning ("failed to find %s, expect ugly output. engine-type='%s', script='%s'", + what, pango_font_map_get_shape_engine_type (fontmap), script_name); |