From 3512eb9905039f0dad597d7591a45b7fa763d2d7 Mon Sep 17 00:00:00 2001 From: Stefano Karapetsas Date: Sun, 6 Oct 2013 18:12:22 +0200 Subject: Properly free GHashTable in properties window Closes #178 https://github.com/mate-desktop/mate-file-manager/issues/178 I had to recover two functions previously removed in eel-glib-extensions. --- eel/eel-glib-extensions.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'eel/eel-glib-extensions.c') diff --git a/eel/eel-glib-extensions.c b/eel/eel-glib-extensions.c index ee108050..96eeb354 100644 --- a/eel/eel-glib-extensions.c +++ b/eel/eel-glib-extensions.c @@ -377,6 +377,34 @@ eel_g_str_list_index (GList *str_list, return -1; } +/** + * eel_g_list_free_deep_custom + * + * Frees the elements of a list and then the list, using a custom free function. + * + * @list: List of elements that can be freed with the provided free function. + * @element_free_func: function to call with the data pointer and user_data to free it. + * @user_data: User data to pass to element_free_func + **/ +void +eel_g_list_free_deep_custom (GList *list, GFunc element_free_func, gpointer user_data) +{ + g_list_foreach (list, element_free_func, user_data); + g_list_free (list); +} + +/** + * eel_g_list_free_deep + * + * Frees the elements of a list and then the list. + * @list: List of elements that can be freed with g_free. + **/ +void +eel_g_list_free_deep (GList *list) +{ + eel_g_list_free_deep_custom (list, (GFunc) g_free, NULL); +} + /** * eel_g_strv_find * -- cgit v1.2.1