diff options
author | Behdad Esfahbod <behdad@gnome.org> | 2009-01-06 09:52:00 +0000 |
---|---|---|
committer | Behdad Esfahbod <behdad@src.gnome.org> | 2009-01-06 09:52:00 +0000 |
commit | 3f5dba1eb77f18c976888ecfc502bf56c617201f (patch) | |
tree | d2cfafd98f63a4d0019ac342614c36c06e9cdd99 /pango/pangofc-fontmap.c | |
parent | 486510ff3d20c93e4fc83ba8a8b763c8cc548a44 (diff) | |
download | pango-3f5dba1eb77f18c976888ecfc502bf56c617201f.tar.gz |
Bug 166676 – pango_fc_font_map_finalize
2009-01-06 Behdad Esfahbod <behdad@gnome.org>
Bug 166676 – pango_fc_font_map_finalize
* pango/pangofc-fontmap.c (pango_fc_font_map_finalize),
(pango_fc_face_describe), (pango_fc_face_list_sizes),
(pango_fc_face_finalize), (pango_fc_face_class_init),
(pango_fc_family_list_faces), (pango_fc_family_finalize),
(pango_fc_family_class_init):
Finalize families and faces.
svn path=/trunk/; revision=2784
Diffstat (limited to 'pango/pangofc-fontmap.c')
-rw-r--r-- | pango/pangofc-fontmap.c | 67 |
1 files changed, 65 insertions, 2 deletions
diff --git a/pango/pangofc-fontmap.c b/pango/pangofc-fontmap.c index 15ca8f05..9339f32e 100644 --- a/pango/pangofc-fontmap.c +++ b/pango/pangofc-fontmap.c @@ -483,7 +483,7 @@ pango_fc_font_map_finalize (GObject *object) { PangoFcFontMap *fcfontmap = PANGO_FC_FONT_MAP (object); PangoFcFontMapPrivate *priv = fcfontmap->priv; - + int i; /* Shutdown, so we clear the fonts and mark them as shut down */ pango_fc_font_map_shutdown (fcfontmap); @@ -505,6 +505,13 @@ pango_fc_font_map_finalize (GObject *object) priv->findfuncs = g_slist_delete_link (priv->findfuncs, priv->findfuncs); } + for (i = 0; i < priv->n_families; i++) + { + priv->families[i]->fontmap = NULL; + g_object_unref (priv->families[i]); + } + g_free (priv->families); + G_OBJECT_CLASS (pango_fc_font_map_parent_class)->finalize (object); } @@ -1642,6 +1649,8 @@ pango_fc_font_description_from_pattern (FcPattern *pattern, gboolean include_siz * PangoFcFace */ +static GObjectClass *pango_fc_face_parent_class = NULL; + static PangoFontDescription * make_alias_description (PangoFcFamily *fcfamily, gboolean bold, @@ -1666,6 +1675,8 @@ pango_fc_face_describe (PangoFontFace *face) FcPattern *match_pattern; FcPattern *result_pattern; + g_return_val_if_fail (fcfamily != NULL, NULL); + if (fcface->fake) { if (strcmp (fcface->style, "Regular") == 0) @@ -1733,6 +1744,11 @@ pango_fc_face_list_sizes (PangoFontFace *face, FcFontSet *fontset; FcObjectSet *objectset; + *sizes = NULL; + *n_sizes = 0; + g_return_if_fail (fcface->family != NULL); + g_return_if_fail (fcface->family->fontmap != NULL); + pattern = FcPatternCreate (); FcPatternAddString (pattern, FC_FAMILY, (FcChar8*)(void*)fcface->family->family_name); FcPatternAddString (pattern, FC_STYLE, (FcChar8*)(void*)fcface->style); @@ -1805,8 +1821,23 @@ pango_fc_face_is_synthesized (PangoFontFace *face) } static void +pango_fc_face_finalize (GObject *object) +{ + PangoFcFace *fcface = PANGO_FC_FACE (object); + + g_free (fcface->style); + + pango_fc_face_parent_class->finalize (object); +} + +static void pango_fc_face_class_init (PangoFontFaceClass *class) { + GObjectClass *object_class = G_OBJECT_CLASS (class); + + pango_fc_face_parent_class = g_type_class_peek_parent (class); + object_class->finalize = pango_fc_face_finalize; + class->describe = pango_fc_face_describe; class->get_face_name = pango_fc_face_get_face_name; class->list_sizes = pango_fc_face_list_sizes; @@ -1845,6 +1876,9 @@ pango_fc_face_get_type (void) /* * PangoFcFamily */ + +static GObjectClass *pango_fc_family_parent_class = NULL; + static PangoFcFace * create_face (PangoFcFamily *fcfamily, const char *style, @@ -1865,7 +1899,13 @@ pango_fc_family_list_faces (PangoFontFamily *family, { PangoFcFamily *fcfamily = PANGO_FC_FAMILY (family); PangoFcFontMap *fcfontmap = fcfamily->fontmap; - PangoFcFontMapPrivate *priv = fcfontmap->priv; + PangoFcFontMapPrivate *priv; + + *faces = NULL; + *n_faces = 0; + g_return_if_fail (fcfontmap != NULL); + + priv = fcfontmap->priv; if (fcfamily->n_faces < 0) { @@ -2003,8 +2043,31 @@ pango_fc_family_is_monospace (PangoFontFamily *family) } static void +pango_fc_family_finalize (GObject *object) +{ + int i; + PangoFcFamily *fcfamily = PANGO_FC_FAMILY (object); + + g_free (fcfamily->family_name); + + for (i = 0; i < fcfamily->n_faces; i++) + { + fcfamily->faces[i]->family = NULL; + g_object_unref (fcfamily->faces[i]); + } + g_free (fcfamily->faces); + + pango_fc_family_parent_class->finalize (object); +} + +static void pango_fc_family_class_init (PangoFontFamilyClass *class) { + GObjectClass *object_class = G_OBJECT_CLASS (class); + + pango_fc_family_parent_class = g_type_class_peek_parent (class); + object_class->finalize = pango_fc_family_finalize; + class->list_faces = pango_fc_family_list_faces; class->get_name = pango_fc_family_get_name; class->is_monospace = pango_fc_family_is_monospace; |