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-application.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/caja-application.c') diff --git a/src/caja-application.c b/src/caja-application.c index edba1d5c..6c68198f 100644 --- a/src/caja-application.c +++ b/src/caja-application.c @@ -75,6 +75,8 @@ #include #include +#include "glibcompat.h" /* for g_list_free_full */ + enum { COMMAND_0, /* unused: 0 is an invalid command */ @@ -257,8 +259,7 @@ automount_all_volumes (CajaApplication *application) /* pass NULL as GMountOperation to avoid user interaction */ g_volume_mount (volume, 0, NULL, NULL, startup_volume_mount_cb, NULL); } - g_list_foreach(volumes, (GFunc) g_object_unref, NULL); - g_list_free(volumes); + g_list_free_full (volumes, g_object_unref); } } @@ -761,8 +762,7 @@ finish_startup (CajaApplication *application, /* listen for eject button presses */ drives = g_volume_monitor_get_connected_drives (application->volume_monitor); g_list_foreach (drives, (GFunc) drive_listen_for_eject_button, application); - g_list_foreach (drives, (GFunc) g_object_unref, NULL); - g_list_free (drives); + g_list_free_full (drives, g_object_unref); application->automount_idle_id = g_idle_add_full (G_PRIORITY_LOW, @@ -1171,9 +1171,7 @@ caja_application_close_desktop (void) { if (caja_application_desktop_windows != NULL) { - g_list_foreach (caja_application_desktop_windows, - (GFunc) gtk_widget_destroy, NULL); - g_list_free (caja_application_desktop_windows); + g_list_free_full (caja_application_desktop_windows, gtk_widget_destroy); caja_application_desktop_windows = NULL; } } -- cgit v1.2.1