Skip to content

Commit

Permalink
gdk/*: Use g_list_free_full convenience function
Browse files Browse the repository at this point in the history
  • Loading branch information
jjardon committed Jan 5, 2012
1 parent 08a2b91 commit 24360a8
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 26 deletions.
3 changes: 1 addition & 2 deletions gdk/broadway/gdkdisplay-broadway.c
Original file line number Diff line number Diff line change
Expand Up @@ -1213,8 +1213,7 @@ gdk_broadway_display_finalize (GObject *object)
_gdk_broadway_cursor_display_finalize (GDK_DISPLAY_OBJECT(broadway_display));

/* input GdkDevice list */
g_list_foreach (broadway_display->input_devices, (GFunc) g_object_unref, NULL);
g_list_free (broadway_display->input_devices);
g_list_free_full (broadway_display->input_devices, g_object_unref);
/* Free all GdkScreens */
g_object_unref (broadway_display->screens[0]);
g_free (broadway_display->screens);
Expand Down
6 changes: 2 additions & 4 deletions gdk/gdkdisplay.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,7 @@ free_device_grabs_foreach (gpointer key,
{
GList *list = value;

g_list_foreach (list, (GFunc) free_device_grab, NULL);
g_list_free (list);
g_list_free_full (list, (GDestroyNotify) free_device_grab);

return TRUE;
}
Expand Down Expand Up @@ -211,8 +210,7 @@ gdk_display_dispose (GObject *object)

device_manager = gdk_display_get_device_manager (GDK_DISPLAY (object));

g_list_foreach (display->queued_events, (GFunc)gdk_event_free, NULL);
g_list_free (display->queued_events);
g_list_free_full (display->queued_events, (GDestroyNotify) gdk_event_free);
display->queued_events = NULL;
display->queued_tail = NULL;

Expand Down
11 changes: 3 additions & 8 deletions gdk/gdkwindow.c
Original file line number Diff line number Diff line change
Expand Up @@ -2065,12 +2065,8 @@ _gdk_window_destroy_hierarchy (GdkWindow *window,
window->clip_region_with_children = NULL;
}

if (window->outstanding_moves)
{
g_list_foreach (window->outstanding_moves, (GFunc)gdk_window_region_move_free, NULL);
g_list_free (window->outstanding_moves);
window->outstanding_moves = NULL;
}
g_list_free_full (window->outstanding_moves, (GDestroyNotify) gdk_window_region_move_free);
window->outstanding_moves = NULL;
}
break;
}
Expand Down Expand Up @@ -3945,8 +3941,7 @@ _gdk_window_process_updates_recurse (GdkWindow *window,
}
}

g_list_foreach (children, (GFunc)g_object_unref, NULL);
g_list_free (children);
g_list_free_full (children, g_object_unref);

}

Expand Down
3 changes: 1 addition & 2 deletions gdk/quartz/gdkdisplay-quartz.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,7 @@ gdk_quartz_display_finalize (GObject *object)
{
GdkQuartzDisplay *display_quartz = GDK_QUARTZ_DISPLAY (object);

g_list_foreach (display_quartz->input_devices, (GFunc) g_object_unref, NULL);
g_list_free (display_quartz->input_devices);
g_list_free_full (display_quartz->input_devices, g_object_unref);

G_OBJECT_CLASS (gdk_quartz_display_parent_class)->finalize (object);
}
Expand Down
3 changes: 1 addition & 2 deletions gdk/wayland/gdkdevice-wayland.c
Original file line number Diff line number Diff line change
Expand Up @@ -823,8 +823,7 @@ gdk_device_manager_core_finalize (GObject *object)

device_manager_core = GDK_DEVICE_MANAGER_CORE (object);

g_list_foreach (device_manager_core->devices, free_device, NULL);
g_list_free (device_manager_core->devices);
g_list_free_full (device_manager_core->devices, free_device);

G_OBJECT_CLASS (gdk_device_manager_core_parent_class)->finalize (object);
}
Expand Down
3 changes: 1 addition & 2 deletions gdk/wayland/gdkdisplay-wayland.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,7 @@ gdk_wayland_display_finalize (GObject *object)
g_object_unref (display_wayland->keymap);

/* input GdkDevice list */
g_list_foreach (display_wayland->input_devices, (GFunc) g_object_unref, NULL);
g_list_free (display_wayland->input_devices);
g_list_free_full (display_wayland->input_devices, g_object_unref);

g_object_unref (display_wayland->screen);

Expand Down
4 changes: 2 additions & 2 deletions gdk/x11/gdkdevicemanager-xi.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,8 @@ gdk_x11_device_manager_xi_dispose (GObject *object)
GdkX11DeviceManagerXI *device_manager;

device_manager = GDK_X11_DEVICE_MANAGER_XI (object);
g_list_foreach (device_manager->devices, (GFunc) g_object_unref, NULL);
g_list_free (device_manager->devices);

g_list_free_full (device_manager->devices, g_object_unref);
device_manager->devices = NULL;

if (device_manager->id_table != NULL)
Expand Down
6 changes: 2 additions & 4 deletions gdk/x11/gdkdisplay-x11.c
Original file line number Diff line number Diff line change
Expand Up @@ -1767,12 +1767,10 @@ gdk_x11_display_finalize (GObject *object)
g_slist_free (display_x11->event_types);

/* input GdkDevice list */
g_list_foreach (display_x11->input_devices, (GFunc) g_object_unref, NULL);
g_list_free (display_x11->input_devices);
g_list_free_full (display_x11->input_devices, g_object_unref);

/* input GdkWindow list */
g_list_foreach (display_x11->input_windows, (GFunc) g_free, NULL);
g_list_free (display_x11->input_windows);
g_list_free_full (display_x11->input_windows, g_free);

/* Free all GdkScreens */
for (i = 0; i < ScreenCount (display_x11->xdisplay); i++)
Expand Down

0 comments on commit 24360a8

Please sign in to comment.