diff options
author | Giovanni Campagna <gcampagna@src.gnome.org> | 2012-07-04 22:28:57 +0200 |
---|---|---|
committer | Giovanni Campagna <gcampagna@src.gnome.org> | 2012-08-07 21:36:31 +0200 |
commit | b0557046f3551c90449cd60a2bcbe66d40851281 (patch) | |
tree | c301c8014e93fef57c9d559003a49bae2db1350f | |
parent | 235a3c0508c90ab31e8d56aed9e4695050247e59 (diff) | |
download | gjs-b0557046f3551c90449cd60a2bcbe66d40851281.tar.gz |
Fix object counters
Previously object counters were defined as int, which allowed them
to be negative. Replacing with unsigned int revealed a number of
places where we weren't incrementing properly, in particular in
dynamic class definitions (prototypes are finalized, and thus would
decrement the counter).
https://bugzilla.gnome.org/show_bug.cgi?id=679688
-rw-r--r-- | gi/boxed.c | 3 | ||||
-rw-r--r-- | gi/gerror.c | 2 | ||||
-rw-r--r-- | gi/interface.c | 1 | ||||
-rw-r--r-- | gi/object.c | 1 | ||||
-rw-r--r-- | gi/param.c | 1 | ||||
-rw-r--r-- | gi/union.c | 2 | ||||
-rw-r--r-- | gjs/mem.h | 2 |
7 files changed, 11 insertions, 1 deletions
@@ -594,6 +594,7 @@ get_nested_interface_object (JSContext *context, if (obj == NULL) return JS_FALSE; + GJS_INC_COUNTER(boxed); priv = g_slice_new0(Boxed); JS_SetPrivate(context, obj, priv); priv->info = (GIBoxedInfo*) interface_info; @@ -1159,6 +1160,7 @@ gjs_define_boxed_class(JSContext *context, g_assert(gjs_object_has_property(context, in_object, constructor_name)); + GJS_INC_COUNTER(boxed); priv = g_slice_new0(Boxed); priv->info = info; g_base_info_ref( (GIBaseInfo*) priv->info); @@ -1224,6 +1226,7 @@ gjs_boxed_from_c_struct(JSContext *context, JS_GET_CLASS(context, proto), proto, gjs_get_import_global (context)); + GJS_INC_COUNTER(boxed); priv = g_slice_new0(Boxed); JS_SetPrivate(context, obj, priv); priv->info = info; diff --git a/gi/gerror.c b/gi/gerror.c index 45dc387f..b5ec1ab2 100644 --- a/gi/gerror.c +++ b/gi/gerror.c @@ -461,6 +461,7 @@ gjs_define_error_class(JSContext *context, g_assert(gjs_object_has_property(context, in_object, constructor_name)); + GJS_INC_COUNTER(gerror); priv = g_slice_new0(Error); priv->info = info; g_base_info_ref( (GIBaseInfo*) priv->info); @@ -611,6 +612,7 @@ gjs_error_from_gerror(JSContext *context, JS_GET_CLASS(context, proto), proto, gjs_get_import_global (context)); + GJS_INC_COUNTER(gerror); priv = g_slice_new0(Error); JS_SetPrivate(context, obj, priv); priv->info = info; diff --git a/gi/interface.c b/gi/interface.c index 9ee76037..c8147b2c 100644 --- a/gi/interface.c +++ b/gi/interface.c @@ -255,6 +255,7 @@ gjs_define_interface_class(JSContext *context, g_assert(gjs_object_has_property(context, in_object, constructor_name)); + GJS_INC_COUNTER(interface); priv = g_slice_new0(Interface); priv->info = info; priv->gtype = g_registered_type_info_get_g_type(priv->info); diff --git a/gi/object.c b/gi/object.c index f4d5e262..7586b131 100644 --- a/gi/object.c +++ b/gi/object.c @@ -1727,6 +1727,7 @@ gjs_define_object_class(JSContext *context, g_assert(gjs_object_has_property(context, in_object, constructor_name)); + GJS_INC_COUNTER(object); priv = g_slice_new0(ObjectInstance); priv->info = info; if (info) @@ -594,6 +594,7 @@ gjs_param_from_g_param(JSContext *context, JS_GET_CLASS(context, proto), proto, gjs_get_import_global (context)); + GJS_INC_COUNTER(param); priv = g_slice_new0(Param); JS_SetPrivate(context, obj, priv); priv->gparam = gparam; @@ -450,6 +450,7 @@ gjs_define_union_class(JSContext *context, g_assert(gjs_object_has_property(context, in_object, constructor_name)); + GJS_INC_COUNTER(boxed); priv = g_slice_new0(Union); priv->info = info; g_base_info_ref( (GIBaseInfo*) priv->info); @@ -514,6 +515,7 @@ gjs_union_from_c_union(JSContext *context, JS_GET_CLASS(context, proto), proto, gjs_get_import_global (context)); + GJS_INC_COUNTER(boxed); priv = g_slice_new0(Union); JS_SetPrivate(context, obj, priv); priv->info = info; @@ -34,7 +34,7 @@ G_BEGIN_DECLS typedef struct { - int value; + unsigned int value; const char *name; } GjsMemCounter; |