[gjs] Throw an exception when registering a GType that already exists
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs] Throw an exception when registering a GType that already exists
- Date: Fri, 24 Aug 2012 13:30:27 +0000 (UTC)
commit 0404112ea190bd3fd9ac6207f70a2bfb3ceddb14
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Thu Jun 21 18:49:17 2012 +0200
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
gi/object.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/gi/object.c b/gi/object.c
index e710100..1b02fae 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)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]