summaryrefslogtreecommitdiff
path: root/pango/pangocoretext.c
diff options
context:
space:
mode:
authorJohn Ralls <jralls@ceridwen.us>2012-09-25 11:40:05 -0700
committerJohn Ralls <jralls@ceridwen.us>2012-09-25 11:42:02 -0700
commita2b560ab7d7cba57a04a3e9d30ab9ecd50c473e3 (patch)
treec0a5aa114a1471d913e60e1f4830ffeb4cbf2c23 /pango/pangocoretext.c
parentf4b3e7b24fa7d3d06002740e98e71559da84adb9 (diff)
downloadpango-a2b560ab7d7cba57a04a3e9d30ab9ecd50c473e3.tar.gz
Port PangoCoreTextFont to use GWeakRef
For its PangoCoreTextFontMap* member.
Diffstat (limited to 'pango/pangocoretext.c')
-rw-r--r--pango/pangocoretext.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/pango/pangocoretext.c b/pango/pangocoretext.c
index ee743935..36bcd825 100644
--- a/pango/pangocoretext.c
+++ b/pango/pangocoretext.c
@@ -45,10 +45,12 @@ pango_core_text_font_finalize (GObject *object)
{
PangoCoreTextFont *ctfont = (PangoCoreTextFont *)object;
PangoCoreTextFontPrivate *priv = ctfont->priv;
-
- g_assert (priv->fontmap != NULL);
- g_object_remove_weak_pointer (G_OBJECT (priv->fontmap), (gpointer *) (gpointer) &priv->fontmap);
- priv->fontmap = NULL;
+ PangoCoreTextFontMap* fontmap = g_weak_ref_get ((GWeakRef *)&priv->fontmap);
+ if (fontmap)
+ {
+ g_weak_ref_clear ((GWeakRef *)&priv->fontmap);
+ g_object_unref (fontmap);
+ }
if (priv->coverage)
pango_coverage_unref (priv->coverage);
@@ -140,7 +142,7 @@ static PangoFontMap *
pango_core_text_font_get_font_map (PangoFont *font)
{
PangoCoreTextFont *ctfont = (PangoCoreTextFont *)font;
-
+ /* FIXME: Not thread safe! */
return ctfont->priv->fontmap;
}
@@ -174,9 +176,8 @@ _pango_core_text_font_set_font_map (PangoCoreTextFont *font,
{
PangoCoreTextFontPrivate *priv = font->priv;
- g_assert (priv->fontmap == NULL);
- priv->fontmap = (PangoFontMap *) fontmap;
- g_object_add_weak_pointer (G_OBJECT (priv->fontmap), (gpointer *) (gpointer) &priv->fontmap);
+ g_return_if_fail (priv->fontmap == NULL);
+ g_weak_ref_set((GWeakRef *) &priv->fontmap, fontmap);
}
void