summaryrefslogtreecommitdiff
path: root/src/lib/eo/eo_base_class.c
diff options
context:
space:
mode:
authorCedric Bail <cedric@osg.samsung.com>2018-04-02 17:18:46 -0700
committerCedric Bail <cedric@osg.samsung.com>2018-04-02 17:18:46 -0700
commit224049fa18bc84d375df3be93435fb1235990c13 (patch)
treef2833bfea6ba03758a0abffdcdef343dde3ef2a4 /src/lib/eo/eo_base_class.c
parent1ca196fbcd5aea30cf1d97190c7525262e9e4664 (diff)
eo: trigger invalidate and noref event before any modification is commited on the object tree.
Diffstat (limited to 'src/lib/eo/eo_base_class.c')
-rw-r--r--src/lib/eo/eo_base_class.c70
1 files changed, 40 insertions, 30 deletions
diff --git a/src/lib/eo/eo_base_class.c b/src/lib/eo/eo_base_class.c
index 4dfde15..fefc106 100644
--- a/src/lib/eo/eo_base_class.c
+++ b/src/lib/eo/eo_base_class.c
@@ -110,6 +110,43 @@ typedef struct
110 110
111static int _eo_nostep_alloc = -1; 111static int _eo_nostep_alloc = -1;
112 112
113static void
114_efl_pending_futures_clear(Efl_Object_Data *pd)
115{
116 while (pd->pending_futures)
117 {
118 Efl_Future_Pending *pending = EINA_INLIST_CONTAINER_GET(pd->pending_futures, Efl_Future_Pending);
119 Eina_Future *future = *pending->desc.storage;
120 assert(future);
121 eina_future_cancel(future);
122 }
123}
124
125// Generate the invalidate event in all case and make sure it happens
126// before any user code can change the children invalidate state. This
127// make sure that the entire tree of object is valid at the time of
128// the invalidate event.
129static void
130_efl_invalidate(Eo *obj)
131{
132 efl_event_callback_call(obj, EFL_EVENT_INVALIDATE, NULL);
133
134 efl_invalidate(obj);
135}
136
137static void
138_efl_object_invalidate(Eo *obj, Efl_Object_Data *pd)
139{
140 _efl_pending_futures_clear(pd);
141 efl_parent_set(obj, NULL);
142 pd->invalidate = EINA_TRUE;
143}
144
145static void
146_efl_object_noref(Eo *obj EINA_UNUSED, Efl_Object_Data *pd EINA_UNUSED)
147{
148}
149
113static inline void 150static inline void
114_efl_object_extension_free(Efl_Object_Extension *ext) 151_efl_object_extension_free(Efl_Object_Extension *ext)
115{ 152{
@@ -676,7 +713,7 @@ _efl_object_parent_set(Eo *obj, Efl_Object_Data *pd, Eo *parent_id)
676 else 713 else
677 { 714 {
678 pd->parent = NULL; 715 pd->parent = NULL;
679 if (prev_parent) efl_invalidate(obj); 716 if (prev_parent) _efl_invalidate(obj);
680 if (prev_parent && !eo_obj->del_triggered) efl_unref(obj); 717 if (prev_parent && !eo_obj->del_triggered) efl_unref(obj);
681 } 718 }
682 719
@@ -1934,18 +1971,6 @@ EAPI const Eina_Value_Type *EFL_DBG_INFO_TYPE = &_EFL_DBG_INFO_TYPE;
1934/* EFL_OBJECT_CLASS stuff */ 1971/* EFL_OBJECT_CLASS stuff */
1935#define MY_CLASS EFL_OBJECT_CLASS 1972#define MY_CLASS EFL_OBJECT_CLASS
1936 1973
1937static void
1938_efl_pending_futures_clear(Efl_Object_Data *pd)
1939{
1940 while (pd->pending_futures)
1941 {
1942 Efl_Future_Pending *pending = EINA_INLIST_CONTAINER_GET(pd->pending_futures, Efl_Future_Pending);
1943 Eina_Future *future = *pending->desc.storage;
1944 assert(future);
1945 eina_future_cancel(future);
1946 }
1947}
1948
1949static Eina_Value 1974static Eina_Value
1950_efl_future_cb(void *data, const Eina_Value value, const Eina_Future *dead_future) 1975_efl_future_cb(void *data, const Eina_Value value, const Eina_Future *dead_future)
1951{ 1976{
@@ -2056,7 +2081,8 @@ _efl_object_destructor(Eo *obj, Efl_Object_Data *pd)
2056 // This can happen when the object has no parent and get 2081 // This can happen when the object has no parent and get
2057 // deleted by efl_unref. 2082 // deleted by efl_unref.
2058 if (!pd->invalidate) 2083 if (!pd->invalidate)
2059 efl_invalidate(obj); 2084 _efl_invalidate(obj);
2085
2060 2086
2061 // special removal - remove from children list by hand after getting 2087 // special removal - remove from children list by hand after getting
2062 // child handle in case unparent method is overridden and does 2088 // child handle in case unparent method is overridden and does
@@ -2170,22 +2196,6 @@ _efl_object_finalize(Eo *obj, Efl_Object_Data *pd EINA_UNUSED)
2170 return obj; 2196 return obj;
2171} 2197}
2172 2198
2173static void
2174_efl_object_invalidate(Eo *obj, Efl_Object_Data *pd)
2175{
2176 efl_event_callback_call(obj, EFL_EVENT_INVALIDATE, NULL);
2177
2178 _efl_pending_futures_clear(pd);
2179 efl_parent_set(obj, NULL);
2180 pd->invalidate = EINA_TRUE;
2181}
2182
2183static void
2184_efl_object_noref(Eo *obj, Efl_Object_Data *pd EINA_UNUSED)
2185{
2186 efl_event_callback_call(obj, EFL_EVENT_NOREF, NULL);
2187}
2188
2189EOLIAN static void 2199EOLIAN static void
2190_efl_object_class_constructor(Efl_Class *klass EINA_UNUSED) 2200_efl_object_class_constructor(Efl_Class *klass EINA_UNUSED)
2191{ 2201{