[gedit/wip/spell-checking] auto-spell: keep a ref to the buffer



commit a837ab7e7b621605da991de9ba478b268a9deaa2
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sun Jul 19 16:43:03 2015 +0200

    auto-spell: keep a ref to the buffer
    
    There is no reference cycles, so it's safer to keep a ref to the buffer.

 plugins/spell/gedit-automatic-spell-checker.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/plugins/spell/gedit-automatic-spell-checker.c b/plugins/spell/gedit-automatic-spell-checker.c
index 22293a4..5b6411c 100644
--- a/plugins/spell/gedit-automatic-spell-checker.c
+++ b/plugins/spell/gedit-automatic-spell-checker.c
@@ -688,7 +688,7 @@ set_buffer (GeditAutomaticSpellChecker *spell,
        g_return_if_fail (spell->buffer == NULL);
        g_return_if_fail (spell->tag_highlight == NULL);
 
-       spell->buffer = GTK_TEXT_BUFFER (buffer);
+       spell->buffer = g_object_ref (buffer);
 
        g_object_set_data (G_OBJECT (buffer),
                           AUTOMATIC_SPELL_CHECKER_KEY,
@@ -911,6 +911,7 @@ gedit_automatic_spell_checker_dispose (GObject *object)
 
                g_object_set_data (G_OBJECT (spell->buffer), AUTOMATIC_SPELL_CHECKER_KEY, NULL);
 
+               g_object_unref (spell->buffer);
                spell->buffer = NULL;
        }
 


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