[seed] check if object is abstract before construction - thanks to Ryan Lortie
- From: Alan Knowles <alank src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [seed] check if object is abstract before construction - thanks to Ryan Lortie
- Date: Fri, 10 Aug 2012 04:17:16 +0000 (UTC)
commit 2076440c15be157ae8a6b16d4e11cce9d92f46b9
Author: Alan Knowles <alan roojs com>
Date: Fri Aug 10 12:16:50 2012 +0800
check if object is abstract before construction - thanks to Ryan Lortie
libseed/seed-engine.c | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/libseed/seed-engine.c b/libseed/seed-engine.c
index 9f0ac39..27419cc 100644
--- a/libseed/seed-engine.c
+++ b/libseed/seed-engine.c
@@ -262,8 +262,20 @@ seed_gobject_constructor_invoked (JSContextRef ctx,
if (jsprops)
JSPropertyNameArrayRelease (jsprops);
+ SEED_NOTE (INITIALIZATION, "G_TYPE_IS_INSTANTIATABLE = %d G_TYPE_IS_ABSTRACT = %d",
+ G_TYPE_IS_INSTANTIATABLE(type) , G_TYPE_IS_ABSTRACT(type));
- gobject = g_object_newv (type, ri, params);
+
+
+ if (! G_TYPE_IS_INSTANTIATABLE(type) || G_TYPE_IS_ABSTRACT(type) ) {
+ seed_make_exception (ctx, exception, "ArgumentError",
+ "Type can not be created - not INSTANTIATABLE");
+
+ return (JSObjectRef) JSValueMakeNull (ctx);
+ }
+
+
+ gobject = g_object_newv (type, ri, params);
if (G_IS_INITIALLY_UNOWNED (gobject) && !g_object_is_floating (gobject))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]