summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeeyong Um <conr2d@gmail.com>2017-03-23 21:24:53 +0900
committerJeeyong Um <conr2d@gmail.com>2017-03-23 21:24:53 +0900
commit8fd02a97cc4118513128a29be87f0cf0b8f8db90 (patch)
tree378335b03dc19cf5dc85641fabe435f7eefc24b3
parenta198859b8738bd2ae99689cc8d1767a49d3a3c07 (diff)
Efl.Observable: Add key to the data of the list of observers
-rw-r--r--src/lib/efl/interfaces/efl_observer.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lib/efl/interfaces/efl_observer.c b/src/lib/efl/interfaces/efl_observer.c
index eb57fc45f4..2cf8e34df7 100644
--- a/src/lib/efl/interfaces/efl_observer.c
+++ b/src/lib/efl/interfaces/efl_observer.c
@@ -15,6 +15,7 @@ typedef struct
15typedef struct 15typedef struct
16{ 16{
17 Eina_List *list; 17 Eina_List *list;
18 Eina_Stringshare *key;
18} Efl_Observer_List; 19} Efl_Observer_List;
19 20
20static int 21static int
@@ -44,6 +45,7 @@ _free_cb(void *data)
44{ 45{
45 Efl_Observer_List *observers = data; 46 Efl_Observer_List *observers = data;
46 eina_list_free(observers->list); 47 eina_list_free(observers->list);
48 eina_stringshare_del(observers->key);
47 free(observers); 49 free(observers);
48} 50}
49 51
@@ -72,7 +74,8 @@ _efl_observable_observer_add(Eo *obj EINA_UNUSED, Efl_Observable_Data *pd, const
72 if (!observers) 74 if (!observers)
73 { 75 {
74 observers = calloc(1, sizeof(Efl_Observer_List)); 76 observers = calloc(1, sizeof(Efl_Observer_List));
75 eina_hash_add(pd->observers, key, observers); 77 observers->key = eina_stringshare_add(key);
78 eina_hash_direct_add(pd->observers, observers->key, observers);
76 } 79 }
77 80
78 or = eina_list_search_sorted(observers->list, _search_cb, obs); 81 or = eina_list_search_sorted(observers->list, _search_cb, obs);