[gtk+] gtk_text_buffer_create_tag(): returns NULL on failure
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] gtk_text_buffer_create_tag(): returns NULL on failure
- Date: Mon, 12 May 2014 17:11:00 +0000 (UTC)
commit 1e3af04dd9a61e2acde4bf86de4f69a24fcb3e22
Author: Sébastien Wilmet <swilmet gnome org>
Date: Thu Apr 4 13:30:42 2013 +0200
gtk_text_buffer_create_tag(): returns NULL on failure
Returns NULL in case of a duplicated tag name in the tag table. It is
still a programmer error to duplicate a name, but if it happens the
behavior is a little nicer (and hopefully doesn't crash).
https://bugzilla.gnome.org/show_bug.cgi?id=614717
gtk/gtktextbuffer.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtktextbuffer.c b/gtk/gtktextbuffer.c
index e562c33..6a03b55 100644
--- a/gtk/gtktextbuffer.c
+++ b/gtk/gtktextbuffer.c
@@ -2493,7 +2493,11 @@ gtk_text_buffer_create_tag (GtkTextBuffer *buffer,
tag = gtk_text_tag_new (tag_name);
- gtk_text_tag_table_add (get_table (buffer), tag);
+ if (!gtk_text_tag_table_add (get_table (buffer), tag))
+ {
+ g_object_unref (tag);
+ return NULL;
+ }
if (first_property_name)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]