Do not add new listener if it is already registered.
authorSung-jae Park <nicesj.park@samsung.com>
Wed, 26 Nov 2014 10:49:58 +0000 (19:49 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Wed, 26 Nov 2014 10:49:58 +0000 (19:49 +0900)
Prevent from duplicated event subscription.

[model] Redwood,Kiran,B3(Wearable)
[binary_type] AP
[customer] Docomo/Orange/ATT/Open
[issue#] N/A
[problem]
[cause]
[solution]
[team] HomeTF
[request]
[horizontal_expansion]

Change-Id: I4a60a46f5095c23b37e56393ebaad9890b115abd

src/event.c

index 95977f1..261e9c0 100644 (file)
@@ -910,6 +910,14 @@ HAPI int event_activate(int x, int y, int (*event_cb)(enum event_state state, st
 {
     struct event_listener *listener;
     int ret = DBOX_STATUS_ERROR_NONE;
+    Eina_List *l;
+
+    EINA_LIST_FOREACH(s_info.event_listener_list, l, listener) {
+       if (listener->event_cb == event_cb && listener->cbdata == data) {
+           ErrPrint("Already registered\n");
+           return DBOX_STATUS_ERROR_ALREADY;
+       }
+    }
 
     listener = malloc(sizeof(*listener));
     if (!listener) {