[perl-Glib-Object-Introspection] Fix registering unregistered enums



commit fac16b151908864382ebaeec9a867d9e3ac4a92f
Author: Torsten Schönfeld <kaffeetisch gmx de>
Date:   Tue Dec 17 19:57:17 2013 +0100

    Fix registering unregistered enums

 NEWS               |    5 +++++
 gperl-i11n-enums.c |    9 +++++----
 2 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/NEWS b/NEWS
index 9075165..cb1fae5 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,8 @@
+Overview of changes in Glib::Object::Introspection <next>
+========================================================
+
+* Fix registering unregistered enums.
+
 Overview of changes in Glib::Object::Introspection 0.017
 ========================================================
 
diff --git a/gperl-i11n-enums.c b/gperl-i11n-enums.c
index 0a471ef..ad3e0a8 100644
--- a/gperl-i11n-enums.c
+++ b/gperl-i11n-enums.c
@@ -27,11 +27,13 @@ register_unregistered_enum (GIEnumInfo *info)
                return gtype;
        }
 
-       /* We have to leak enum_values as g_enum_register_static and
+       info_type = g_base_info_get_type (info);
+
+       /* We have to leak 'values' as g_enum_register_static and
         * g_flags_register_static assume that what we pass in will be valid
         * throughout the lifetime of the program. */
        gint i, n_values = g_enum_info_get_n_values (info);
-       if (info_type ==  GI_INFO_TYPE_ENUM) {
+       if (info_type == GI_INFO_TYPE_ENUM) {
                values = g_new0 (GEnumValue, n_values+1); /* zero-terminated */
                FILL_VALUES ((GEnumValue *) values);
        } else {
@@ -39,8 +41,7 @@ register_unregistered_enum (GIEnumInfo *info)
                FILL_VALUES ((GFlagsValue *) values);
        }
 
-       info_type = g_base_info_get_type(info);
-       if (info_type ==  GI_INFO_TYPE_ENUM) {
+       if (info_type == GI_INFO_TYPE_ENUM) {
                gtype = g_enum_register_static (full_name, (GEnumValue *) values);
        } else {
                gtype = g_flags_register_static (full_name, (GFlagsValue *) values);


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