haptic: watch/unwatch name with correct id 90/169290/1 accepted/tizen/unified/20180206.064218 submit/tizen/20180205.120610
authorsanghyeok.oh <sanghyeok.oh@samsung.com>
Mon, 5 Feb 2018 11:52:03 +0000 (20:52 +0900)
committersanghyeok.oh <sanghyeok.oh@samsung.com>
Mon, 5 Feb 2018 11:52:06 +0000 (20:52 +0900)
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 <sanghyeok.oh@samsung.com>
src/core/dbus.c
src/haptic/haptic.c

index f21a073..42137a7 100644 (file)
@@ -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) {
index 4578fce..231e374 100644 (file)
@@ -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);