diff options
author | Behdad Esfahbod <behdad@behdad.org> | 2013-03-15 05:57:52 -0400 |
---|---|---|
committer | Behdad Esfahbod <behdad@behdad.org> | 2013-03-15 06:25:33 -0400 |
commit | 16e4dd37e5fdd231a32bba6a1238ff01408c783d (patch) | |
tree | b8e1079d711ab4cc55d48942443430be677e35cf /pango/pangowin32.c | |
parent | e95a0ecd5d1bbcc0c96fc52160edc18292f66f04 (diff) | |
download | pango-16e4dd37e5fdd231a32bba6a1238ff01408c783d.tar.gz |
Port PangoWin32 to use GWeakRef
Patch from Chun-wei Fan.
Diffstat (limited to 'pango/pangowin32.c')
-rw-r--r-- | pango/pangowin32.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/pango/pangowin32.c b/pango/pangowin32.c index 8678ebbc..bb5b9751 100644 --- a/pango/pangowin32.c +++ b/pango/pangowin32.c @@ -818,8 +818,10 @@ pango_win32_font_finalize (GObject *object) { PangoWin32Font *win32font = (PangoWin32Font *)object; PangoWin32FontCache *cache = pango_win32_font_map_get_font_cache (win32font->fontmap); + PangoWin32Font *fontmap; + if (G_UNLIKELY (!cache)) - return NULL; + return; if (win32font->hfont != NULL) pango_win32_font_cache_unload (cache, win32font->hfont); @@ -832,11 +834,9 @@ pango_win32_font_finalize (GObject *object) g_hash_table_destroy (win32font->glyph_info); - if (win32font->fontmap) - { - g_object_remove_weak_pointer (G_OBJECT (win32font->fontmap), (gpointer *) (gpointer) &win32font->fontmap); - win32font->fontmap = NULL; - } + fontmap = g_weak_ref_get ((GWeakRef *) &win32font->fontmap); + if (fontmap) + g_object_unref (fontmap); G_OBJECT_CLASS (_pango_win32_font_parent_class)->finalize (object); } |