[gnome-panel/wip/muktupavels/issue-42: 4/5] clock: use g_list_free_full to free locations




commit ff7100906380e8585be3689a14c2e358d4de406f
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Sun Oct 16 22:51:14 2022 +0300

    clock: use g_list_free_full to free locations

 modules/clock/clock-applet.c | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)
---
diff --git a/modules/clock/clock-applet.c b/modules/clock/clock-applet.c
index 88377ce3b..e94286f64 100644
--- a/modules/clock/clock-applet.c
+++ b/modules/clock/clock-applet.c
@@ -210,18 +210,6 @@ update_clock (GnomeWallClock *wall_clock, GParamSpec *pspec, ClockApplet *cd)
                 clock_map_update_time (CLOCK_MAP (cd->map_widget));
 }
 
-static void
-free_locations (ClockApplet *cd)
-{
-        GList *l;
-
-        for (l = cd->locations; l; l = l->next)
-                g_object_unref (l->data);
-
-        g_list_free (cd->locations);
-        cd->locations = NULL;
-}
-
 static gboolean
 close_on_escape (GtkWidget       *widget,
                 GdkEventKey     *event,
@@ -1750,7 +1738,10 @@ clock_applet_dispose (GObject *object)
 
         g_clear_object (&applet->world);
 
-        free_locations (applet);
+        if (applet->locations != NULL) {
+                g_list_free_full (applet->locations, g_object_unref);
+                applet->locations = NULL;
+        }
 
         if (applet->location_tiles != NULL) {
                 g_list_free (applet->location_tiles);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]