From b02b6b0fe430b9dcb137f4aaf24efde94ba70afe Mon Sep 17 00:00:00 2001 From: rbuj Date: Thu, 14 Mar 2019 08:19:47 +0100 Subject: Use g_list_free_full() convenience function void g_list_free_full (GList *list, GDestroyNotify free_func); Convenience method, which frees all the memory used by a GList, and calls free_func on every element's data. https://developer.gnome.org/glib/stable/glib-Doubly-Linked-Lists.html#g-list-free-full --- trashapplet/src/trashapplet.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'trashapplet') diff --git a/trashapplet/src/trashapplet.c b/trashapplet/src/trashapplet.c index 4d99f576..b2fc95f0 100644 --- a/trashapplet/src/trashapplet.c +++ b/trashapplet/src/trashapplet.c @@ -588,10 +588,8 @@ trash_applet_drag_data_received (GtkWidget *widget, } } - g_list_foreach (untrashable, (GFunc)g_object_unref, NULL); - g_list_free (untrashable); - g_list_foreach (trashed, (GFunc)g_object_unref, NULL); - g_list_free (trashed); + g_list_free_full (untrashable, g_object_unref); + g_list_free_full (trashed, g_object_unref); g_strfreev (list); -- cgit v1.2.1