gjs r133 - trunk/gi



Author: jobi
Date: Tue Dec  9 15:29:15 2008
New Revision: 133
URL: http://svn.gnome.org/viewvc/gjs?rev=133&view=rev

Log:
Test GValue before Struct

otherwise a GArg containing a GValue will be handled as a struct.

http://bugzilla.gnome.org/show_bug.cgi?id=561664

Modified:
   trunk/gi/arg.c

Modified: trunk/gi/arg.c
==============================================================================
--- trunk/gi/arg.c	(original)
+++ trunk/gi/arg.c	Tue Dec  9 15:29:15 2008
@@ -921,7 +921,19 @@
                 goto out;
             }
 
-            /* Handle Struct/Union first since we don't necessarily need a GType for them */
+            gtype = g_registered_type_info_get_g_type((GIRegisteredTypeInfo*)symbol_info);
+            gjs_debug_marshal(GJS_DEBUG_GFUNCTION,
+                              "gtype of SYMBOL is %s", g_type_name(gtype));
+
+
+            /* Test GValue before Struct, or it will be handled as the latter */
+            if (g_type_is_a(gtype, G_TYPE_VALUE)) {
+                if (!gjs_value_from_g_value(context, &value, arg->v_pointer))
+                    value = JSVAL_VOID; /* Make sure error is flagged */
+
+                goto out;
+            }
+
             if (symbol_type == GI_INFO_TYPE_STRUCT || symbol_type == GI_INFO_TYPE_BOXED) {
                 JSObject *obj;
                 obj = gjs_boxed_from_c_struct(context, (GIStructInfo *)symbol_info, arg->v_pointer);
@@ -938,18 +950,6 @@
                 goto out;
             }
 
-            gtype = g_registered_type_info_get_g_type((GIRegisteredTypeInfo*)symbol_info);
-            gjs_debug_marshal(GJS_DEBUG_GFUNCTION,
-                              "gtype of SYMBOL is %s", g_type_name(gtype));
-
-
-            if (g_type_is_a(gtype, G_TYPE_VALUE)) {
-                if (!gjs_value_from_g_value(context, &value, arg->v_pointer))
-                    value = JSVAL_VOID; /* Make sure error is flagged */
-
-                goto out;
-            }
-
             if (g_type_is_a(gtype, G_TYPE_OBJECT) || g_type_is_a(gtype, G_TYPE_INTERFACE)) {
                 JSObject *obj;
                 obj = gjs_object_from_g_object(context, G_OBJECT(arg->v_pointer));



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