diff options
author | Christopher Davis <christopherdavis@gnome.org> | 2022-10-10 19:10:58 -0400 |
---|---|---|
committer | Christopher Davis <brainblasted@disroot.org> | 2022-12-24 19:00:12 +0000 |
commit | 4c7c70a42c5de48a1a4306f6c100e0601a869f5b (patch) | |
tree | a06860ee25ef1a77c92ca9b48b8c5a8cf747a77b | |
parent | a50d9701c7880fb83544acccb542b8803e399848 (diff) | |
download | gnome-font-viewer-4c7c70a42c5de48a1a4306f6c100e0601a869f5b.tar.gz |
font-model: Leak cleanups
-rw-r--r-- | src/font-model.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/font-model.c b/src/font-model.c index e26811e..baee640 100644 --- a/src/font-model.c +++ b/src/font-model.c @@ -81,6 +81,8 @@ font_view_model_item_finalize (GObject *obj) FontViewModelItem *self = FONT_VIEW_MODEL_ITEM (obj); g_clear_pointer (&self->font_name, g_free); + g_clear_pointer (&self->font_preview_text, g_free); + g_clear_pointer (&self->font_description, pango_font_description_free); g_clear_object (&self->file); G_OBJECT_CLASS (font_view_model_item_parent_class)->finalize (obj); @@ -133,7 +135,7 @@ font_view_model_item_init (FontViewModelItem *self) static FontViewModelItem * font_view_model_item_new (const gchar *font_name, const gchar *font_preview_text, - const PangoFontDescription *font_description, + PangoFontDescription *font_description, GFile *file, int face_index) { @@ -141,7 +143,7 @@ font_view_model_item_new (const gchar *font_name, item->font_name = g_strdup (font_name); item->font_preview_text = g_strdup (font_preview_text); - item->font_description = pango_font_description_copy (font_description); + item->font_description = font_description; item->file = g_object_ref (file); item->face_index = face_index; @@ -189,7 +191,7 @@ font_view_model_has_face (FontViewModel *self, FT_Face face) match_name = sushi_get_font_name (face, TRUE); for (idx = 0; idx < n_items; idx++) { - FontViewModelItem *item = + g_autoptr (FontViewModelItem) item = g_list_model_get_item (G_LIST_MODEL (self->model), idx); if (g_strcmp0 (item->font_name, match_name) == 0) @@ -466,9 +468,9 @@ connect_to_fontconfig_updates (FontViewModel *self) GtkSettings *settings; settings = gtk_settings_get_default (); - self->fontconfig_update_id = - g_signal_connect_swapped (settings, "notify::gtk-fontconfig-timestamp", - G_CALLBACK (ensure_font_list), self); + g_signal_connect_object (settings, "notify::gtk-fontconfig-timestamp", + G_CALLBACK (ensure_font_list), self, + G_CONNECT_SWAPPED); } static void @@ -528,3 +530,4 @@ font_view_model_get_list_model (FontViewModel *self) { return G_LIST_MODEL (self->model); } + |