diff options
author | Giovanni Campagna <gcampagna@src.gnome.org> | 2012-06-21 18:49:17 +0200 |
---|---|---|
committer | Giovanni Campagna <gcampagna@src.gnome.org> | 2012-08-24 15:30:01 +0200 |
commit | 0404112ea190bd3fd9ac6207f70a2bfb3ceddb14 (patch) | |
tree | 147187397f0a5c1abecac21ddfb6807b07adedcc | |
parent | 6546426343ef06cd27857e082a083b07cd1084d0 (diff) | |
download | gjs-0404112ea190bd3fd9ac6207f70a2bfb3ceddb14.tar.gz |
Throw an exception when registering a GType that already exists
The GType system only logs a warning in that case, and it can
make bugs harder to track.
https://bugzilla.gnome.org/show_bug.cgi?id=669350
-rw-r--r-- | gi/object.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/gi/object.c b/gi/object.c index e7101000..1b02fae9 100644 --- a/gi/object.c +++ b/gi/object.c @@ -2292,6 +2292,11 @@ gjs_register_type(JSContext *cx, if (!do_base_typecheck(cx, parent, JS_TRUE)) return JS_FALSE; + if (g_type_from_name(name) != G_TYPE_INVALID) { + gjs_throw (cx, "Type name %s is already registered", name); + return JS_FALSE; + } + parent_priv = priv_from_js(cx, parent); if (!parent_priv) |