From b00cccb74307a49df74deb785936e3cd9cf3a5ad Mon Sep 17 00:00:00 2001 From: Jasmine Hassan Date: Fri, 23 Nov 2012 11:18:34 +0200 Subject: [all] include src/glibcompat.h & use g_list_free_full() where needed Also fixes a double-free regression in lc-p/caja-query from 7a42b9b0 --- src/caja-window.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src/caja-window.c') diff --git a/src/caja-window.c b/src/caja-window.c index 35b78432..25003f6b 100644 --- a/src/caja-window.c +++ b/src/caja-window.c @@ -65,6 +65,8 @@ #include #include +#include "glibcompat.h" /* for g_list_free_full */ + #define MAX_HISTORY_ITEMS 50 #define EXTRA_VIEW_WIDGETS_BACKGROUND "#a7c6e1" @@ -343,8 +345,7 @@ caja_window_go_up (CajaWindow *window, gboolean close_behind, gboolean new_tab) g_object_unref (parent); - g_list_foreach(selection, (GFunc) g_object_unref, NULL); - g_list_free(selection); + g_list_free_full (selection, g_object_unref); } static void @@ -606,8 +607,7 @@ caja_window_get_property (GObject *object, static void free_stored_viewers (CajaWindow *window) { - g_list_foreach(window->details->short_list_viewers, (GFunc) g_free, NULL); - g_list_free(window->details->short_list_viewers); + g_list_free_full (window->details->short_list_viewers, g_free); window->details->short_list_viewers = NULL; g_free (window->details->extra_viewer); window->details->extra_viewer = NULL; @@ -626,8 +626,7 @@ caja_window_destroy (GtkObject *object) /* close all panes safely */ panes_copy = g_list_copy (window->details->panes); - g_list_foreach (panes_copy, (GFunc) caja_window_close_pane, NULL); - g_list_free (panes_copy); + g_list_free_full (panes_copy, caja_window_close_pane); /* the panes list should now be empty */ g_assert (window->details->panes == NULL); @@ -1760,8 +1759,7 @@ caja_send_history_list_changed (void) static void free_history_list (void) { - g_list_foreach(history_list, (GFunc) g_object_unref, NULL); - g_list_free(history_list); + g_list_free_full (history_list, g_object_unref); history_list = NULL; } -- cgit v1.2.1