summaryrefslogtreecommitdiff
path: root/pango/pangowin32-fontmap.c
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2013-03-15 05:57:52 -0400
committerBehdad Esfahbod <behdad@behdad.org>2013-03-15 06:25:33 -0400
commit16e4dd37e5fdd231a32bba6a1238ff01408c783d (patch)
treeb8e1079d711ab4cc55d48942443430be677e35cf /pango/pangowin32-fontmap.c
parente95a0ecd5d1bbcc0c96fc52160edc18292f66f04 (diff)
downloadpango-16e4dd37e5fdd231a32bba6a1238ff01408c783d.tar.gz
Port PangoWin32 to use GWeakRef
Patch from Chun-wei Fan.
Diffstat (limited to 'pango/pangowin32-fontmap.c')
-rw-r--r--pango/pangowin32-fontmap.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/pango/pangowin32-fontmap.c b/pango/pangowin32-fontmap.c
index 460afb21..eb54e61d 100644
--- a/pango/pangowin32-fontmap.c
+++ b/pango/pangowin32-fontmap.c
@@ -678,7 +678,7 @@ pango_win32_font_map_fontset_add_fonts (PangoFontMap *fontmap,
/* Mostly use the "old" pango_font_map_fontset_add_fonts() */
/* on Windows so that we can go through the .aliases file */
/* to load the appropriate fontset for various texts */
- PangoFont *font, *result;
+ PangoFont *font;
char **aliases;
int n_aliases;
int j;
@@ -989,9 +989,9 @@ pango_win32_font_neww (PangoFontMap *fontmap,
result = (PangoWin32Font *)g_object_new (PANGO_TYPE_WIN32_FONT, NULL);
- g_assert (result->fontmap == NULL);
- result->fontmap = fontmap;
- g_object_add_weak_pointer (G_OBJECT (result->fontmap), (gpointer *) (gpointer) &result->fontmap);
+ if (G_UNLIKELY(result->fontmap))
+ return result;
+ g_weak_ref_set ((GWeakRef *)&result->fontmap, fontmap);
result->size = size;
_pango_win32_make_matching_logfontw (fontmap, lfp, size, &result->logfontw);