diff options
author | Marc-Andre Lureau <marcandre.lureau@gmail.com> | 2008-02-20 18:32:43 +0000 |
---|---|---|
committer | Marc-Andre Lureau <malureau@src.gnome.org> | 2008-02-20 18:32:43 +0000 |
commit | e4fe214f391feddc17754926b8335ee57d4b97df (patch) | |
tree | 5d6813e6a918553b1892d332ccb70864998e6600 /gtk/gtkbuilder.c | |
parent | bd55012996073ea30042ef4308b153e948ba87b6 (diff) | |
download | gtk+-e4fe214f391feddc17754926b8335ee57d4b97df.tar.gz |
fix missing call to g_type_class_unref in case of error. (#517563)
2008-02-20 Marc-Andre Lureau <marcandre.lureau@gmail.com>
* gtk/gtkbuilder.c (_gtk_builder_enum_from_string): fix missing
call to g_type_class_unref in case of error. (#517563)
svn path=/trunk/; revision=19619
Diffstat (limited to 'gtk/gtkbuilder.c')
-rw-r--r-- | gtk/gtkbuilder.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/gtk/gtkbuilder.c b/gtk/gtkbuilder.c index 87c42f60d4..5e347c5353 100644 --- a/gtk/gtkbuilder.c +++ b/gtk/gtkbuilder.c @@ -1265,10 +1265,13 @@ _gtk_builder_enum_from_string (GType type, GEnumValue *ev; gchar *endptr; gint value; + gboolean ret; - g_return_val_if_fail (G_TYPE_IS_ENUM (type), 0); - g_return_val_if_fail (string != NULL, 0); + g_return_val_if_fail (G_TYPE_IS_ENUM (type), FALSE); + g_return_val_if_fail (string != NULL, FALSE); + ret = TRUE; + value = strtoul (string, &endptr, 0); if (endptr != string) /* parsed a number */ *enum_value = value; @@ -1288,13 +1291,13 @@ _gtk_builder_enum_from_string (GType type, GTK_BUILDER_ERROR_INVALID_VALUE, "Could not parse enum: `%s'", string); - return FALSE; + ret = FALSE; } g_type_class_unref (eclass); } - return TRUE; + return ret; } gboolean @@ -1305,15 +1308,15 @@ _gtk_builder_flags_from_string (GType type, { GFlagsClass *fclass; gchar *endptr, *prevptr; - guint i, j, ret, value; + guint i, j, value; gchar *flagstr; GFlagsValue *fv; const gchar *flag; gunichar ch; - gboolean eos; + gboolean eos, ret; - g_return_val_if_fail (G_TYPE_IS_FLAGS (type), 0); - g_return_val_if_fail (string != 0, 0); + g_return_val_if_fail (G_TYPE_IS_FLAGS (type), FALSE); + g_return_val_if_fail (string != 0, FALSE); ret = TRUE; |