From 6dc68905dc9f12fad4fd28eff839b0877a40cfe4 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Wed, 19 Aug 2009 16:16:14 +0200 Subject: [PATCH] dbus: check for signal uniqness Signed-off-by: Julien Danjou --- dbus.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dbus.c b/dbus.c index d5f88d5cf..7c6572d61 100644 --- a/dbus.c +++ b/dbus.c @@ -651,7 +651,12 @@ luaA_dbus_add_signal(lua_State *L) { const char *name = luaL_checkstring(L, 1); luaA_checkfunction(L, 2); - signal_add(&dbus_signals, name, luaA_object_ref(L, 2)); + signal_t *sig = signal_array_getbyid(&dbus_signals, + a_strhash((const unsigned char *) name)); + if(sig) + luaA_warn(L, "cannot add signal %s on D-Bus, already existing", name); + else + signal_add(&dbus_signals, name, luaA_object_ref(L, 2)); return 0; }