[gnote] Call reference when using Glib::RefPtr<NoteEditor>



commit 4ccecf02c08488206322291e934db680a12f00ea
Author: Debarshi Ray <debarshir src gnome org>
Date:   Thu Nov 26 03:30:47 2009 +0200

    Call reference when using Glib::RefPtr<NoteEditor>
    
    The NoteEditor is Gtk::managed and constructing a
    Glib::RefPtr<NoteEditor> from a NoteEditor* does not increment the
    reference count. So the destruction of the Glib::RefPtr should be
    prevented from reducing its reference count.
    
    Fixes: https://bugzilla.gnome.org/586541

 src/watchers.cpp |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/src/watchers.cpp b/src/watchers.cpp
index 101689d..98f8f8d 100644
--- a/src/watchers.cpp
+++ b/src/watchers.cpp
@@ -1105,8 +1105,9 @@ namespace gnote {
         const Glib::RefPtr<Gtk::TextTag>& tag(*tag_iter);
 
         if (NoteTagTable::tag_is_activatable (tag)) {
-          retval = tag->event (Glib::RefPtr<Gtk::TextView>(get_window()->editor()), 
-                               (GdkEvent*)ev, iter);
+          Glib::RefPtr<Gtk::TextView> editor(get_window()->editor());
+          editor->reference();
+          retval = tag->event (editor, (GdkEvent*)ev, iter);
           if (retval) {
             break;
           }



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