[gjs: 4/5] Throw a better warning for GValues containing container types



commit 4b95a86780fa4170ec343088143cb7f8d4aac7bc
Author: Danielle Madeley <danielle madeley collabora co uk>
Date:   Fri Jun 18 15:58:14 2010 +1000

    Throw a better warning for GValues containing container types

 gi/value.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/gi/value.c b/gi/value.c
index c5454db..674f1b1 100644
--- a/gi/value.c
+++ b/gi/value.c
@@ -573,6 +573,13 @@ gjs_value_from_g_value_internal(JSContext    *context,
             gjs_throw(context, "Failed to convert strv to array");
             return JS_FALSE;
         }
+    } else if (g_type_is_a(gtype, G_TYPE_HASH_TABLE) ||
+               g_type_is_a(gtype, G_TYPE_ARRAY) ||
+               g_type_is_a(gtype, G_TYPE_BYTE_ARRAY) ||
+               g_type_is_a(gtype, G_TYPE_PTR_ARRAY)) {
+        gjs_throw(context,
+                  "Unable to introspect element-type of container in GValue");
+        return JS_FALSE;
     } else if (g_type_is_a(gtype, G_TYPE_BOXED)) {
         GjsBoxedCreationFlags boxed_flags;
         GIBaseInfo *info;



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