summaryrefslogtreecommitdiff
path: root/src/lib/eo/eo_base_class.c
diff options
context:
space:
mode:
authorCedric Bail <cedric@osg.samsung.com>2018-05-09 20:07:01 -0700
committerCedric BAIL <cedric@osg.samsung.com>2018-05-24 16:02:19 -0700
commitd052f001bee68517af7e6d5fec47c2345fff33f2 (patch)
tree6e0ef7b057c8d973a35bf5e5a39167cbbbd273ec /src/lib/eo/eo_base_class.c
parent3a1fe147423d171d5564183c71204a6e25f87762 (diff)
eo: move destruction of the link with children to be always after invalidate.
Diffstat (limited to 'src/lib/eo/eo_base_class.c')
-rw-r--r--src/lib/eo/eo_base_class.c51
1 files changed, 41 insertions, 10 deletions
diff --git a/src/lib/eo/eo_base_class.c b/src/lib/eo/eo_base_class.c
index 3baff35..d3c7619 100644
--- a/src/lib/eo/eo_base_class.c
+++ b/src/lib/eo/eo_base_class.c
@@ -132,21 +132,11 @@ _efl_pending_futures_clear(Efl_Object_Data *pd)
132static void 132static void
133_efl_object_invalidate(Eo *obj_id, Efl_Object_Data *pd) 133_efl_object_invalidate(Eo *obj_id, Efl_Object_Data *pd)
134{ 134{
135 Eina_Inlist *l;
136 _Eo_Object *child;
137
138 _efl_pending_futures_clear(pd); 135 _efl_pending_futures_clear(pd);
139 136
140 EO_OBJ_POINTER(obj_id, obj); 137 EO_OBJ_POINTER(obj_id, obj);
141 if (obj->invalidate) goto end; 138 if (obj->invalidate) goto end;
142 139
143 // Invalidate all children too
144 EINA_INLIST_FOREACH_SAFE(pd->children, l, child)
145 {
146 Eo *child_id = _eo_obj_id_get(child);
147 efl_parent_set(child_id, NULL);
148 }
149
150 // Finally invalidate itself if it wasn't done already 140 // Finally invalidate itself if it wasn't done already
151 // I am not sure this is a good idea, but it force the 141 // I am not sure this is a good idea, but it force the
152 // behavior of calling directly efl_invalidate to be the 142 // behavior of calling directly efl_invalidate to be the
@@ -160,6 +150,47 @@ _efl_object_invalidate(Eo *obj_id, Efl_Object_Data *pd)
160 EO_OBJ_DONE(obj_id); 150 EO_OBJ_DONE(obj_id);
161} 151}
162 152
153// Generate the invalidate event in all case and make sure it happens
154// before any user code can change the children invalidate state. This
155// make sure that the entire tree of object is valid at the time of
156// the invalidate event.
157void
158_efl_invalidate(_Eo_Object *obj)
159{
160 Eina_Array stash = { 0 };
161 Efl_Object_Data *pd;
162 _Eo_Object *child;
163 Eo *id;
164
165 if (obj->is_invalidating) return ;
166 obj->is_invalidating = EINA_TRUE;
167 if (obj->invalidate) return;
168
169 id = _eo_obj_id_get(obj);
170
171 efl_event_callback_call(id, EFL_EVENT_INVALIDATE, NULL);
172
173 pd = efl_data_scope_get(id, EFL_OBJECT_CLASS);
174
175 efl_invalidate(id);
176
177 eina_array_step_set(&stash, sizeof (stash), 4);
178
179 // Invalidate all children too
180 EINA_INLIST_FOREACH(pd->children, child)
181 eina_array_push(&stash, _efl_ref(child));
182
183 while ((child = eina_array_pop(&stash)))
184 {
185 Eo *child_id = _eo_obj_id_get(child);
186
187 efl_parent_set(child_id, NULL);
188 _efl_unref(child);
189 }
190
191 eina_array_flush(&stash);
192}
193
163static void 194static void
164_efl_object_noref(Eo *obj EINA_UNUSED, Efl_Object_Data *pd EINA_UNUSED) 195_efl_object_noref(Eo *obj EINA_UNUSED, Efl_Object_Data *pd EINA_UNUSED)
165{ 196{