[gtksourceview/gnome-3-24] buffer: gtk_source_buffer_create_source_mark is transfer none
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/gnome-3-24] buffer: gtk_source_buffer_create_source_mark is transfer none
- Date: Tue, 19 Feb 2019 20:10:33 +0000 (UTC)
commit 8796b34007be5452d57bc3942de0d2accf83e971
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 977870a4..7dfc638e 100644
--- a/gtksourceview/gtksourcebuffer.c
+++ b/gtksourceview/gtksourcebuffer.c
@@ -2053,6 +2053,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]