[gnome-applets/wip/segeiger/window-picker-in-process: 3/9] windowpicker/applet.c: Fix object destruction with correct dispose function



commit ace249eabe0ed656cfe0e78ed8c0736e5e36a928
Author: Sebastian Geiger <sbastig gmx net>
Date:   Sun Jun 7 20:32:35 2015 +0200

    windowpicker/applet.c: Fix object destruction with correct dispose function

 windowpicker/src/applet.c |   17 +++++++----------
 1 files changed, 7 insertions(+), 10 deletions(-)
---
diff --git a/windowpicker/src/applet.c b/windowpicker/src/applet.c
index 6b4a062..71fbf8c 100644
--- a/windowpicker/src/applet.c
+++ b/windowpicker/src/applet.c
@@ -373,15 +373,13 @@ window_picker_set_property(GObject *object,
 }
 
 static void
-window_picker_finalize(GObject *object) {
-    WindowPickerApplet *windowPickerApplet = WINDOW_PICKER_APPLET(object);
+window_picker_dispose (GObject *object) {
+    WindowPickerApplet *applet = WINDOW_PICKER_APPLET(object);
+    g_clear_object (&applet->priv->tasks);
+    g_clear_object (&applet->priv->title);
+    g_clear_object (&applet->priv->settings);
 
-    if (windowPickerApplet->priv->settings) {
-        g_object_unref(windowPickerApplet->priv->settings);
-        windowPickerApplet->priv->settings = NULL;
-    }
-
-    G_OBJECT_CLASS (window_picker_applet_parent_class)->finalize(object);
+    G_OBJECT_CLASS (window_picker_applet_parent_class)->dispose (object);
 }
 
 static void
@@ -390,7 +388,6 @@ window_picker_applet_init (WindowPickerApplet *picker)
     picker->priv = window_picker_applet_get_instance_private (picker);
     picker->priv->tasks = NULL;
     picker->priv->title = NULL;
-
     picker->priv->settings = NULL;
 }
 
@@ -398,7 +395,7 @@ static void
 window_picker_applet_class_init (WindowPickerAppletClass *class)
 {
     GObjectClass *obj_class = G_OBJECT_CLASS (class);
-    obj_class->finalize = window_picker_finalize;
+    obj_class->dispose = window_picker_dispose;
     obj_class->set_property = window_picker_set_property;
     obj_class->get_property = window_picker_get_property;
 


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