summaryrefslogtreecommitdiff
path: root/pango
diff options
context:
space:
mode:
Diffstat (limited to 'pango')
-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;