[devhelp/wip/stuff: 2/2] sidebar: improve disposing



commit c5be1c82a25fca77793d415b89ddca981e054c0c
Author: Ignacio Casal Quinteiro <ignacio casal nice-software com>
Date:   Thu Jul 25 10:36:27 2013 +0200

    sidebar: improve disposing

 src/dh-sidebar.c |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/src/dh-sidebar.c b/src/dh-sidebar.c
index 2b1ec5c..51dd31b 100644
--- a/src/dh-sidebar.c
+++ b/src/dh-sidebar.c
@@ -430,17 +430,27 @@ dh_sidebar_new (DhBookManager *book_manager)
 }
 
 static void
-sidebar_finalize (GObject *object)
+dh_sidebar_finalize (GObject *object)
 {
         DhSidebar *self = DH_SIDEBAR (object);
 
         g_completion_free (self->priv->completion);
-        g_object_unref (self->priv->book_manager);
 
         G_OBJECT_CLASS (dh_sidebar_parent_class)->finalize (object);
 }
 
 static void
+dh_sidebar_dispose (GObject *object)
+{
+        DhSidebarPrivate *priv = DH_SIDEBAR (object)->priv;
+
+        g_clear_object (&priv->book_manager);
+
+        G_OBJECT_CLASS (dh_sidebar_parent_class)->dispose (object);
+}
+
+
+static void
 dh_sidebar_init (DhSidebar *self)
 {
         GtkCellRenderer  *cell;
@@ -627,7 +637,8 @@ dh_sidebar_class_init (DhSidebarClass *klass)
 {
         GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
-        object_class->finalize = sidebar_finalize;
+        object_class->finalize = dh_sidebar_finalize;
+        object_class->dispose = dh_sidebar_dispose;
         object_class->get_property = dh_sidebar_get_property;
         object_class->set_property = dh_sidebar_set_property;
         object_class->constructed = dh_sidebar_constructed;


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