[seed] Add a feature to debug builds that checks signal connection arity



commit 2057a7c39333fcdc3e8799d8fa2d4a3bbaddc2d9
Author: Robert Carr <racarr mireia (none)>
Date:   Tue Apr 14 01:26:04 2009 -0400

    Add a feature to debug builds that checks signal connection arity
---
 libseed/seed-signals.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/libseed/seed-signals.c b/libseed/seed-signals.c
index 1127bec..05c8ac1 100644
--- a/libseed/seed-signals.c
+++ b/libseed/seed-signals.c
@@ -70,6 +70,20 @@ seed_gobject_signal_connect (JSContextRef ctx,
 
   g_signal_query (g_signal_lookup (signal_name, G_OBJECT_TYPE (on_obj)),
 		  &query);
+#ifdef SEED_ENABLE_DEBUG
+  {
+    guint function_arity = 
+      seed_value_to_uint (ctx,
+			  seed_object_get_property(ctx, func, "length"),
+			  NULL);
+    if (function_arity != query.n_params)
+      {
+	SEED_MARK();
+	SEED_NOTE(SIGNAL, "Connecting signal: %s. Function has arity %d, signal expects %d", query.signal_name, function_arity, query.n_params);
+	SEED_MARK();
+      }
+  }
+#endif
 
   closure = g_closure_new_simple (sizeof (SeedClosure), 0);
   g_closure_add_finalize_notifier (closure, 0, closure_invalidated);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]