summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2009-07-20 16:49:16 -0400
committerBehdad Esfahbod <behdad@behdad.org>2009-07-20 16:49:16 -0400
commit1eadda908f0f9262dcb4c301f487b5a190dc0e54 (patch)
tree9d0edd89b503cf11bd3e9f6c8e8f2fe1f56df602
parent5a75ce1414f43a36a5e510cc5cfac085671bfdca (diff)
downloadpango-1eadda908f0f9262dcb4c301f487b5a190dc0e54.tar.gz
Bug 589133 – Firefox 3.5 complains about invalid weak references
-rw-r--r--pango/pangofc-font.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/pango/pangofc-font.c b/pango/pangofc-font.c
index 1b210cd5..8fc5a579 100644
--- a/pango/pangofc-font.c
+++ b/pango/pangofc-font.c
@@ -45,6 +45,7 @@ struct _PangoFcFontPrivate
PangoFcDecoder *decoder;
PangoFcFontKey *key;
PangoFcCmapCache *cmap_cache;
+ gboolean has_weak_pointer; /* have set a weak_pointer from fontmap to us */
};
static gboolean pango_fc_font_real_has_char (PangoFcFont *font,
@@ -142,7 +143,11 @@ pango_fc_font_finalize (GObject *object)
if (fcfont->fontmap)
{
_pango_fc_font_map_remove (PANGO_FC_FONT_MAP (fcfont->fontmap), fcfont);
- g_object_remove_weak_pointer (G_OBJECT (fcfont->fontmap), (gpointer *) (gpointer) &fcfont->fontmap);
+ if (priv->has_weak_pointer)
+ {
+ priv->has_weak_pointer = FALSE;
+ g_object_remove_weak_pointer (G_OBJECT (fcfont->fontmap), (gpointer *) (gpointer) &fcfont->fontmap);
+ }
fcfont->fontmap = NULL;
}
@@ -224,7 +229,11 @@ pango_fc_font_set_property (GObject *object,
g_return_if_fail (fcfont->fontmap == NULL);
fcfont->fontmap = (PangoFontMap *) fcfontmap;
if (fcfont->fontmap)
- g_object_add_weak_pointer (G_OBJECT (fcfont->fontmap), (gpointer *) (gpointer) &fcfont->fontmap);
+ {
+ PangoFcFontPrivate *priv = fcfont->priv;
+ priv->has_weak_pointer = TRUE;
+ g_object_add_weak_pointer (G_OBJECT (fcfont->fontmap), (gpointer *) (gpointer) &fcfont->fontmap);
+ }
}
goto set_decoder;