[gnome-control-center/gnome-3-34] user-accounts: Fix a leak on destruction of CcCarousel



commit b0566221dd9a25393ccfb496fdd6f69250097723
Author: Philip Withnall <withnall endlessm com>
Date:   Mon Jan 13 11:50:40 2020 +0000

    user-accounts: Fix a leak on destruction of CcCarousel
    
    Signed-off-by: Philip Withnall <withnall endlessm com>

 panels/user-accounts/cc-carousel.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
---
diff --git a/panels/user-accounts/cc-carousel.c b/panels/user-accounts/cc-carousel.c
index f9b8bb8b7..1524096f4 100644
--- a/panels/user-accounts/cc-carousel.c
+++ b/panels/user-accounts/cc-carousel.c
@@ -350,9 +350,24 @@ cc_carousel_new (void)
         return g_object_new (CC_TYPE_CAROUSEL, NULL);
 }
 
+static void
+cc_carousel_dispose (GObject *object)
+{
+        CcCarousel *self = CC_CAROUSEL (object);
+
+        g_clear_object (&self->provider);
+        if (self->children != NULL) {
+                g_list_free (self->children);
+                self->children = NULL;
+        }
+
+        G_OBJECT_CLASS (cc_carousel_parent_class)->dispose (object);
+}
+
 static void
 cc_carousel_class_init (CcCarouselClass *klass)
 {
+        GObjectClass *object_class = G_OBJECT_CLASS (klass);
         GtkWidgetClass *wclass = GTK_WIDGET_CLASS (klass);
         GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
 
@@ -367,6 +382,8 @@ cc_carousel_class_init (CcCarouselClass *klass)
         gtk_widget_class_bind_template_callback (wclass, cc_carousel_goto_previous_page);
         gtk_widget_class_bind_template_callback (wclass, cc_carousel_goto_next_page);
 
+        object_class->dispose = cc_carousel_dispose;
+
         container_class->add = cc_carousel_add;
 
         signals[ITEM_ACTIVATED] = g_signal_new ("item-activated",


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