[gtksourceview] CompletionContext: keep a ref to the mark



commit 4e606302a6085d9a9ffe8aba2a221534d3ee5ed4
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Fri Jun 27 23:50:32 2014 +0200

    CompletionContext: keep a ref to the mark
    
    gtk_text_mark_get_buffer() is called in dispose(), but if the buffer is
    already destroyed, the mark will be destroyed too if we don't keep a
    ref.

 gtksourceview/gtksourcecompletioncontext.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/gtksourceview/gtksourcecompletioncontext.c b/gtksourceview/gtksourcecompletioncontext.c
index 47840c6..f89abe5 100644
--- a/gtksourceview/gtksourcecompletioncontext.c
+++ b/gtksourceview/gtksourcecompletioncontext.c
@@ -126,6 +126,7 @@ gtk_source_completion_context_dispose (GObject *object)
                        gtk_text_buffer_delete_mark (buffer, context->priv->mark);
                }
 
+               g_object_unref (context->priv->mark);
                context->priv->mark = NULL;
        }
 
@@ -143,6 +144,7 @@ gtk_source_completion_context_set_iter (GtkSourceCompletionContext *context,
        if (context->priv->mark == NULL)
        {
                context->priv->mark = gtk_text_buffer_create_mark (buffer, NULL, iter, FALSE);
+               g_object_ref (context->priv->mark);
        }
        else
        {


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