[gtksourceview] buffer: gtk_source_buffer_create_source_mark is transfer none



commit c96c159d75b7ff58826e182c4a67244eead21dc1
Author: Christian Hergert <chergert redhat com>
Date:   Tue Feb 19 11:27:47 2019 -0800

    buffer: gtk_source_buffer_create_source_mark is transfer none
    
    This makes our code adhere to the contract defined in the documentation
    that is this function should return a borrowed reference, not a full
    reference.
    
    This function has been miss-documented since 2003 in commit
    fe2df9df6741d3d484ea73243d43bad09f0d6c5b so I think it is safe to implement
    it as documented.
    
    Related to #39

 gtksourceview/gtksourcebuffer.c | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/gtksourceview/gtksourcebuffer.c b/gtksourceview/gtksourcebuffer.c
index ec357af9..bb2ad62a 100644
--- a/gtksourceview/gtksourcebuffer.c
+++ b/gtksourceview/gtksourcebuffer.c
@@ -2051,6 +2051,12 @@ gtk_source_buffer_create_source_mark (GtkSourceBuffer   *buffer,
                                  GTK_TEXT_MARK (mark),
                                  where);
 
+       /* We want to return a borrowed reference and the mark is already
+        * owned by @buffer due to gtk_text_buffer_add_mark(). Therefore
+        * it is safe to unref immediately.
+        */
+       g_object_unref (mark);
+
        return mark;
 }
 


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