[gtksourceview/wip/regex-search] SearchContext: free the found_tag



commit 89cb7078552f10adf7dbd012e8d83c247db43f3f
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Mon Aug 5 21:33:33 2013 +0200

    SearchContext: free the found_tag

 gtksourceview/gtksourcesearchcontext.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/gtksourceview/gtksourcesearchcontext.c b/gtksourceview/gtksourcesearchcontext.c
index fa9edf2..bab4706 100644
--- a/gtksourceview/gtksourcesearchcontext.c
+++ b/gtksourceview/gtksourcesearchcontext.c
@@ -2414,6 +2414,7 @@ set_buffer (GtkSourceSearchContext *search,
                                 G_CONNECT_AFTER | G_CONNECT_SWAPPED);
 
        search->priv->found_tag = gtk_text_buffer_create_tag (search->priv->buffer, NULL, NULL);
+       g_object_ref (search->priv->found_tag);
 
        sync_found_tag (search);
 
@@ -2505,6 +2506,15 @@ gtk_source_search_context_dispose (GObject *object)
 
        clear_search (search);
 
+       if (search->priv->found_tag != NULL)
+       {
+               GtkTextTagTable *tag_table = gtk_text_buffer_get_tag_table (search->priv->buffer);
+
+               gtk_text_tag_table_remove (tag_table, search->priv->found_tag);
+
+               g_clear_object (&search->priv->found_tag);
+       }
+
        g_clear_object (&search->priv->buffer);
        g_clear_object (&search->priv->settings);
 


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