From d634bf6a2618fc460083022d57fd4b48117139eb Mon Sep 17 00:00:00 2001 From: "sanghyeok.oh" Date: Mon, 5 Feb 2018 20:52:03 +0900 Subject: [PATCH] haptic: watch/unwatch name with correct id multiple haptic_info struct can be added into haptic_handle_list, but abnormal name watching id is assigned to one global variable, fix this to use correct id for each haptic_info struct Change-Id: Ia2360120bdbd6ca6bdcc47ad6e071a90f7f462f9 Signed-off-by: sanghyeok.oh --- src/core/dbus.c | 9 ++++++++- src/haptic/haptic.c | 6 +++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/core/dbus.c b/src/core/dbus.c index f21a073..42137a7 100644 --- a/src/core/dbus.c +++ b/src/core/dbus.c @@ -981,7 +981,14 @@ static int _dbus_handle_register_dbus_object(dbus_handle_h handle, const char *o goto err; } - _E("%s", buf); + /* todo: delete this */ +#if 0 + if (strlen(buf) <= 512) { + _E("%s", buf); + } else { + _E("%s", buf + strlen(buf) - 512); + } +#endif nodeinfo = g_dbus_node_info_new_for_xml(buf, &err); if (!nodeinfo || err) { diff --git a/src/haptic/haptic.c b/src/haptic/haptic.c index 4578fce..231e374 100644 --- a/src/haptic/haptic.c +++ b/src/haptic/haptic.c @@ -63,6 +63,7 @@ struct haptic_info { char *sender; dd_list *handle_list; + guint id_watch; }; struct vibrate_effect_info { @@ -196,7 +197,6 @@ void haptic_name_owner_changed(GDBusConnection *connection, remove_haptic_info(info); } -static guint id_name_watch; static struct haptic_info *add_haptic_info(const char *sender) { struct haptic_info *info; @@ -210,7 +210,7 @@ static struct haptic_info *add_haptic_info(const char *sender) info->sender = strdup(sender); DD_LIST_APPEND(haptic_handle_list, info); - id_name_watch = dbus_handle_watch_name(sender, NULL, haptic_name_owner_changed, info); + info->id_watch = dbus_handle_watch_name(sender, NULL, haptic_name_owner_changed, info); return info; } @@ -219,7 +219,7 @@ static int remove_haptic_info(struct haptic_info *info) { assert(info); - dbus_handle_unwatch_name(id_name_watch); + dbus_handle_unwatch_name(info->id_watch); DD_LIST_REMOVE(haptic_handle_list, info); DD_LIST_FREE_LIST(info->handle_list); -- 2.7.4