[gjs] Revert "gtype: Don't recurse infinitely while getting a GType"
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs] Revert "gtype: Don't recurse infinitely while getting a GType"
- Date: Thu, 9 May 2013 22:03:50 +0000 (UTC)
commit fde823f9b1d45d91d905a1107ca6bd1dc04dd4a4
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Thu May 9 18:03:04 2013 -0400
Revert "gtype: Don't recurse infinitely while getting a GType"
This reverts commit df28a9c070459cc90b0ea0db19bf8e0568ac396a.
It seems this breaks some uses of GtkListStore through some
GValue shenanigans, which most GNOME apps use.
gi/gtype.c | 21 +++++++--------------
1 files changed, 7 insertions(+), 14 deletions(-)
---
diff --git a/gi/gtype.c b/gi/gtype.c
index 9c0bb75..850b926 100644
--- a/gi/gtype.c
+++ b/gi/gtype.c
@@ -145,10 +145,9 @@ gjs_gtype_create_gtype_wrapper (JSContext *context,
return object;
}
-static GType
-_gjs_gtype_get_actual_gtype (JSContext *context,
- JSObject *object,
- gboolean recurse)
+GType
+gjs_gtype_get_actual_gtype (JSContext *context,
+ JSObject *object)
{
GType gtype = G_TYPE_INVALID;
jsval gtype_val = JSVAL_VOID;
@@ -163,23 +162,17 @@ _gjs_gtype_get_actual_gtype (JSContext *context,
* property on that and hope it's a GType wrapper object */
if (!JS_GetProperty(context, object, "$gtype", >ype_val) ||
!JSVAL_IS_OBJECT(gtype_val)) {
+
/* OK, so we're not a class. But maybe we're an instance. Check
- * for "constructor" and recurse on that. */
+ for "constructor" and recurse on that. */
if (!JS_GetProperty(context, object, "constructor", >ype_val))
goto out;
}
- if (recurse && JSVAL_IS_OBJECT(gtype_val))
- gtype = _gjs_gtype_get_actual_gtype(context, JSVAL_TO_OBJECT(gtype_val), FALSE);
+ if (JSVAL_IS_OBJECT(gtype_val))
+ gtype = gjs_gtype_get_actual_gtype(context, JSVAL_TO_OBJECT(gtype_val));
out:
JS_EndRequest(context);
return gtype;
}
-
-GType
-gjs_gtype_get_actual_gtype (JSContext *context,
- JSObject *object)
-{
- return _gjs_gtype_get_actual_gtype(context, object, TRUE);
-}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]