diff options
-rw-r--r-- | clutter/clutter-text.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/clutter/clutter-text.c b/clutter/clutter-text.c index 3cefa83fb..b460c1862 100644 --- a/clutter/clutter-text.c +++ b/clutter/clutter-text.c @@ -557,8 +557,7 @@ clutter_text_dirty_cache (ClutterText *text) * @desc: a #PangoFontDescription * * Sets @desc as the font description to be used by the #ClutterText - * actor. The font description ownership is transferred to @self so - * the #PangoFontDescription must not be freed after this function + * actor. The #PangoFontDescription is copied. * * This function will also set the :font-name field as a side-effect * @@ -577,7 +576,7 @@ clutter_text_set_font_description_internal (ClutterText *self, if (priv->font_desc != NULL) pango_font_description_free (priv->font_desc); - priv->font_desc = desc; + priv->font_desc = pango_font_description_copy (desc); /* update the font name string we use */ g_free (priv->font_name); @@ -619,6 +618,7 @@ clutter_text_settings_changed_cb (ClutterText *text) font_desc = pango_font_description_from_string (font_name); clutter_text_set_font_description_internal (text, font_desc); + pango_font_description_free (font_desc); g_free (font_name); } @@ -4918,12 +4918,9 @@ void clutter_text_set_font_description (ClutterText *self, PangoFontDescription *font_desc) { - PangoFontDescription *copy; - g_return_if_fail (CLUTTER_IS_TEXT (self)); - copy = pango_font_description_copy (font_desc); - clutter_text_set_font_description_internal (self, copy); + clutter_text_set_font_description_internal (self, font_desc); } /** @@ -5021,7 +5018,7 @@ clutter_text_set_font_name (ClutterText *self, goto out; desc = pango_font_description_from_string (font_name); - if (!desc) + if (desc == NULL) { g_warning ("Attempting to create a PangoFontDescription for " "font name '%s', but failed.", @@ -5035,6 +5032,8 @@ clutter_text_set_font_name (ClutterText *self, g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_FONT_NAME]); + pango_font_description_free (desc); + out: if (is_default_font) g_free ((gchar *) font_name); |