[gitg] Finalize GitgDiffView properly



commit 9583ad558aac2bd1178e2c6ab19a36d8257720e6
Author: Jesse van den Kieboom <jessevdk gnome org>
Date:   Sun May 30 21:14:19 2010 +0200

    Finalize GitgDiffView properly

 gitg/gitg-diff-view.c |   21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)
---
diff --git a/gitg/gitg-diff-view.c b/gitg/gitg-diff-view.c
index ffa9e8f..c4599c8 100644
--- a/gitg/gitg-diff-view.c
+++ b/gitg/gitg-diff-view.c
@@ -207,10 +207,6 @@ gitg_diff_view_finalize (GObject *object)
 	regions_free (view);
 	g_sequence_free (view->priv->regions_index);
 
-	disable_diff_view (view);
-
-	g_object_unref (view->priv->line_renderer);
-
 	if (view->priv->label_func &&
 	    view->priv->label_func_destroy_notify)
 	{
@@ -221,6 +217,22 @@ gitg_diff_view_finalize (GObject *object)
 }
 
 static void
+gitg_diff_view_dispose (GObject *object)
+{
+	GitgDiffView *view = GITG_DIFF_VIEW (object);
+
+	disable_diff_view (view);
+
+	if (view->priv->line_renderer)
+	{
+		g_object_unref (view->priv->line_renderer);
+		view->priv->line_renderer = NULL;
+	}
+
+	G_OBJECT_CLASS (gitg_diff_view_parent_class)->dispose (object);
+}
+
+static void
 set_diff_enabled (GitgDiffView *view,
                   gboolean      enabled)
 {
@@ -292,6 +304,7 @@ gitg_diff_view_class_init(GitgDiffViewClass *klass)
 	GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
 
 	object_class->finalize = gitg_diff_view_finalize;
+	object_class->dispose = gitg_diff_view_dispose;
 	object_class->set_property = gitg_diff_view_set_property;
 	object_class->get_property = gitg_diff_view_get_property;
 



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