[gnome-builder] source-view: hold references to text marks



commit a112122f3e1aa529693acde6e05b46547094cace
Author: Christian Hergert <chergert redhat com>
Date:   Mon May 9 09:52:46 2016 +0300

    source-view: hold references to text marks

 libide/ide-source-view.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/libide/ide-source-view.c b/libide/ide-source-view.c
index 5c36ba8..35e1bc5 100644
--- a/libide/ide-source-view.c
+++ b/libide/ide-source-view.c
@@ -1560,6 +1560,9 @@ ide_source_view_bind_buffer (IdeSourceView  *self,
   priv->definition_highlight_end_mark =
     gtk_text_buffer_create_mark (GTK_TEXT_BUFFER (buffer), NULL, &iter, TRUE);
 
+  g_object_ref (priv->definition_highlight_start_mark);
+  g_object_ref (priv->definition_highlight_end_mark);
+
   ide_source_view__buffer_notify_language_cb (self, NULL, buffer);
   ide_source_view__buffer_notify_file_cb (self, NULL, buffer);
   ide_source_view__buffer_notify_highlight_diagnostics_cb (self, NULL, buffer);
@@ -1615,9 +1618,8 @@ ide_source_view_unbind_buffer (IdeSourceView  *self,
   g_clear_object (&priv->search_context);
   g_clear_object (&priv->indenter_adapter);
   g_clear_object (&priv->completion_providers);
-
-  priv->definition_highlight_start_mark = NULL;
-  priv->definition_highlight_end_mark = NULL;
+  g_clear_object (&priv->definition_highlight_start_mark);
+  g_clear_object (&priv->definition_highlight_end_mark);
 
   ide_buffer_release (priv->buffer);
 }


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