[seed] libseed: Attempting to connect a signal to something which is not a function should throw a signal a
- From: Robert Carr <racarr src gnome org>
- To: svn-commits-list gnome org
- Subject: [seed] libseed: Attempting to connect a signal to something which is not a function should throw a signal a
- Date: Wed, 13 May 2009 00:27:38 -0400 (EDT)
commit 774cc2f5e705a2333cc12d8d3a550ced6c8251e3
Author: Robert Carr <racarr svn gnome org>
Date: Wed May 13 00:27:14 2009 -0400
libseed: Attempting to connect a signal to something which is not a function should throw a signal at CONNECTION time
---
libseed/seed-signals.c | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/libseed/seed-signals.c b/libseed/seed-signals.c
index 3865b72..8a9a008 100644
--- a/libseed/seed-signals.c
+++ b/libseed/seed-signals.c
@@ -96,6 +96,17 @@ seed_gobject_signal_connect_by_name (JSContextRef ctx,
return JSValueMakeNull (ctx);
}
+ if (JSValueIsNull (ctx, arguments[1]) ||
+ !JSValueIsObject (ctx, arguments[1]) ||
+ !JSObjectIsFunction (ctx, (JSObjectRef) arguments[1]))
+ {
+ seed_make_exception (ctx, exception, "ArgumentError",
+ "Signal connection by name "
+ "requires a function"
+ " as second argument");
+ return JSValueMakeNull (ctx);
+ }
+
if (argumentCount == 3)
{
user_data = (JSObjectRef) arguments[2];
@@ -289,6 +300,16 @@ seed_gobject_signal_connect_on_property (JSContextRef ctx,
return JSValueMakeNull (ctx);
}
+
+ if (JSValueIsNull (ctx, arguments[0]) ||
+ !JSValueIsObject (ctx, arguments[0]) ||
+ !JSObjectIsFunction (ctx, (JSObjectRef) arguments[0]))
+ {
+ seed_make_exception (ctx, exception, "ArgumentError",
+ "Signal connection requires a function"
+ " as first argument");
+ return JSValueMakeNull (ctx);
+ }
if (argumentCount == 1)
seed_gobject_signal_connect (ctx, privates->signal_name,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]