[libhandy] examples: Don't leak action group in the tabs demo



commit 37132b8cdcea09ac0f8f8cebee2f8017f9fd6aae
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Mon Mar 22 15:28:36 2021 +0500

    examples: Don't leak action group in the tabs demo

 examples/hdy-tab-view-demo-window.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
---
diff --git a/examples/hdy-tab-view-demo-window.c b/examples/hdy-tab-view-demo-window.c
index 7f4f46e3..b66330e9 100644
--- a/examples/hdy-tab-view-demo-window.c
+++ b/examples/hdy-tab-view-demo-window.c
@@ -462,11 +462,24 @@ extra_drag_data_received_cb (HdyTabViewDemoWindow *self,
   hdy_tab_page_set_title (page, text);
 }
 
+static void
+hdy_tab_view_demo_window_dispose (GObject *object)
+{
+  HdyTabViewDemoWindow *self = HDY_TAB_VIEW_DEMO_WINDOW (object);
+
+  g_clear_object (&self->tab_action_group);
+
+  G_OBJECT_CLASS (hdy_tab_view_demo_window_parent_class)->dispose (object);
+}
+
 static void
 hdy_tab_view_demo_window_class_init (HdyTabViewDemoWindowClass *klass)
 {
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
 
+  object_class->dispose = hdy_tab_view_demo_window_dispose;
+
   gtk_widget_class_set_template_from_resource (widget_class, 
"/sm/puri/Handy/Demo/ui/hdy-tab-view-demo-window.ui");
   gtk_widget_class_bind_template_child (widget_class, HdyTabViewDemoWindow, view);
   gtk_widget_class_bind_template_child (widget_class, HdyTabViewDemoWindow, tab_bar);


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