[gtksourceview] bgo #615392 - Fix remaining accessor problems with -DGSEAL_ENABLE



commit f395f5bf4f950c2486ae21628aa44b8ce8058a8f
Author: Mirsal Ennaime <mirsal ennaime gmail com>
Date:   Sat Apr 17 19:35:59 2010 +0200

    bgo #615392 - Fix remaining accessor problems with -DGSEAL_ENABLE
    
    This patch is the first in a series aimed at removing all direct
    access to gtk+ object fields in order to fulfill the UseGseal goal
    as described at http://live.gnome.org/GnomeGoals/UseGseal

 gtksourceview/gtksourceview.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/gtksourceview/gtksourceview.c b/gtksourceview/gtksourceview.c
index 86d02ea..1e611ba 100644
--- a/gtksourceview/gtksourceview.c
+++ b/gtksourceview/gtksourceview.c
@@ -854,10 +854,8 @@ gtk_source_view_get_property (GObject    *object,
 static void
 notify_buffer (GtkSourceView *view)
 {
-	/* we use view->buffer directly instead of get_buffer()
-	 * since the latter causes the buffer to be recreated and that
-	 * is not a good idea when finalizing */
-	set_source_buffer (view, GTK_TEXT_VIEW (view)->buffer);
+	set_source_buffer (view,
+		gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)));
 }
 
 static gint
@@ -1639,6 +1637,9 @@ gtk_source_view_finalize (GObject *object)
 	if (view->priv->right_gutter)
 		g_object_unref (view->priv->right_gutter);
 
+	/* notify_buffer() would recreate the buffer if it is set to null,
+	 * and we don't want that to happen when finalizing */
+	g_signal_handlers_disconnect_by_func (view, notify_buffer, NULL);
 	set_source_buffer (view, NULL);
 
 	G_OBJECT_CLASS (gtk_source_view_parent_class)->finalize (object);



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