diff options
author | Carsten Haitzler (Rasterman) <raster@rasterman.com> | 2013-11-03 21:43:11 +0900 |
---|---|---|
committer | Carsten Haitzler (Rasterman) <raster@rasterman.com> | 2013-11-03 21:43:11 +0900 |
commit | eb6af1f1ff7ee069eff8bab13c0eed5010ef5660 (patch) | |
tree | 4f747c2868dbdc40d2a41f21589fe505ea8581d7 /src | |
parent | 9337af1187451414dfc4d170b603efef9a3cad6a (diff) |
evas - clip shutdown fix to avoid invalid mem accesses
many valgrind complaints on e shutdown are there regarding accessing
cow sections, lists and object elements during shutdown. this plugs
theses little holes to avoid the invalid accesses and thus avoids
potential crashes.
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/evas/canvas/evas_clip.c | 20 | ||||
-rw-r--r-- | src/lib/evas/canvas/evas_object_main.c | 25 |
2 files changed, 34 insertions, 11 deletions
diff --git a/src/lib/evas/canvas/evas_clip.c b/src/lib/evas/canvas/evas_clip.c index 76cddc0301..5dfbc4871a 100644 --- a/src/lib/evas/canvas/evas_clip.c +++ b/src/lib/evas/canvas/evas_clip.c | |||
@@ -369,6 +369,7 @@ _clip_unset(Eo *eo_obj, void *_pd, va_list *list EINA_UNUSED) | |||
369 | { | 369 | { |
370 | Evas_Object_Protected_Data *obj = _pd; | 370 | Evas_Object_Protected_Data *obj = _pd; |
371 | 371 | ||
372 | if (!obj->cur) return; | ||
372 | if (!obj->cur->clipper) return; | 373 | if (!obj->cur->clipper) return; |
373 | 374 | ||
374 | obj->clip.cache_clipees_answer = eina_list_free(obj->clip.cache_clipees_answer); | 375 | obj->clip.cache_clipees_answer = eina_list_free(obj->clip.cache_clipees_answer); |
@@ -386,7 +387,7 @@ _clip_unset(Eo *eo_obj, void *_pd, va_list *list EINA_UNUSED) | |||
386 | { | 387 | { |
387 | EINA_COW_STATE_WRITE_BEGIN(obj->cur->clipper, state_write, cur) | 388 | EINA_COW_STATE_WRITE_BEGIN(obj->cur->clipper, state_write, cur) |
388 | { | 389 | { |
389 | state_write->have_clipees = 0; | 390 | if (state_write) state_write->have_clipees = 0; |
390 | } | 391 | } |
391 | EINA_COW_STATE_WRITE_END(obj->cur->clipper, state_write, cur); | 392 | EINA_COW_STATE_WRITE_END(obj->cur->clipper, state_write, cur); |
392 | 393 | ||
@@ -417,14 +418,17 @@ _clip_unset(Eo *eo_obj, void *_pd, va_list *list EINA_UNUSED) | |||
417 | if ((!obj->is_smart) && | 418 | if ((!obj->is_smart) && |
418 | (!((obj->map->cur.map) && (obj->map->cur.usemap)))) | 419 | (!((obj->map->cur.map) && (obj->map->cur.usemap)))) |
419 | { | 420 | { |
420 | if (evas_object_is_in_output_rect(eo_obj, obj, | 421 | if (obj->cur) |
422 | { | ||
423 | if (evas_object_is_in_output_rect(eo_obj, obj, | ||
424 | obj->layer->evas->pointer.x, | ||
425 | obj->layer->evas->pointer.y, 1, 1)) | ||
426 | evas_event_feed_mouse_move(obj->layer->evas->evas, | ||
421 | obj->layer->evas->pointer.x, | 427 | obj->layer->evas->pointer.x, |
422 | obj->layer->evas->pointer.y, 1, 1)) | 428 | obj->layer->evas->pointer.y, |
423 | evas_event_feed_mouse_move(obj->layer->evas->evas, | 429 | obj->layer->evas->last_timestamp, |
424 | obj->layer->evas->pointer.x, | 430 | NULL); |
425 | obj->layer->evas->pointer.y, | 431 | } |
426 | obj->layer->evas->last_timestamp, | ||
427 | NULL); | ||
428 | } | 432 | } |
429 | evas_object_clip_across_check(eo_obj, obj); | 433 | evas_object_clip_across_check(eo_obj, obj); |
430 | } | 434 | } |
diff --git a/src/lib/evas/canvas/evas_object_main.c b/src/lib/evas/canvas/evas_object_main.c index 27fc7adfe4..c779f2d97a 100644 --- a/src/lib/evas/canvas/evas_object_main.c +++ b/src/lib/evas/canvas/evas_object_main.c | |||
@@ -141,6 +141,7 @@ void | |||
141 | evas_object_free(Evas_Object *eo_obj, int clean_layer) | 141 | evas_object_free(Evas_Object *eo_obj, int clean_layer) |
142 | { | 142 | { |
143 | Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, MY_CLASS); | 143 | Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, MY_CLASS); |
144 | Evas_Object *eo_obj2; | ||
144 | if (!obj) return; | 145 | if (!obj) return; |
145 | obj->clean_layer = clean_layer; | 146 | obj->clean_layer = clean_layer; |
146 | 147 | ||
@@ -171,8 +172,21 @@ evas_object_free(Evas_Object *eo_obj, int clean_layer) | |||
171 | obj->func->free(eo_obj, obj, obj->private_data); | 172 | obj->func->free(eo_obj, obj, obj->private_data); |
172 | } | 173 | } |
173 | if (!was_smart_child) evas_object_release(eo_obj, obj, obj->clean_layer); | 174 | if (!was_smart_child) evas_object_release(eo_obj, obj, obj->clean_layer); |
174 | if (obj->clip.clipees) | 175 | EINA_LIST_FREE(obj->clip.clipees, eo_obj2) |
175 | eina_list_free(obj->clip.clipees); | 176 | { |
177 | Evas_Object_Protected_Data *obj2 = | ||
178 | eo_data_scope_get(eo_obj2, MY_CLASS); | ||
179 | if ((obj2) && (obj2->cur)) | ||
180 | { | ||
181 | EINA_COW_STATE_WRITE_BEGIN(obj2, state_write, cur) | ||
182 | { | ||
183 | state_write->clipper = NULL; | ||
184 | } | ||
185 | EINA_COW_STATE_WRITE_END(obj2, state_write, cur); | ||
186 | } | ||
187 | } | ||
188 | // if (obj->clip.clipees) | ||
189 | // obj->clip.clipees = eina_list_free(obj->clip.clipees); | ||
176 | obj->clip.cache_clipees_answer = eina_list_free(obj->clip.cache_clipees_answer); | 190 | obj->clip.cache_clipees_answer = eina_list_free(obj->clip.cache_clipees_answer); |
177 | evas_object_clip_changes_clean(eo_obj); | 191 | evas_object_clip_changes_clean(eo_obj); |
178 | evas_object_event_callback_all_del(eo_obj); | 192 | evas_object_event_callback_all_del(eo_obj); |
@@ -188,12 +202,17 @@ evas_object_free(Evas_Object *eo_obj, int clean_layer) | |||
188 | } | 202 | } |
189 | if (obj->size_hints) | 203 | if (obj->size_hints) |
190 | { | 204 | { |
191 | EVAS_MEMPOOL_FREE(_mp_sh, obj->size_hints); | 205 | EVAS_MEMPOOL_FREE(_mp_sh, obj->size_hints); |
206 | obj->size_hints = NULL; | ||
192 | } | 207 | } |
193 | eina_cow_free(evas_object_proxy_cow, obj->proxy); | 208 | eina_cow_free(evas_object_proxy_cow, obj->proxy); |
194 | eina_cow_free(evas_object_map_cow, obj->map); | 209 | eina_cow_free(evas_object_map_cow, obj->map); |
195 | eina_cow_free(evas_object_state_cow, obj->cur); | 210 | eina_cow_free(evas_object_state_cow, obj->cur); |
196 | eina_cow_free(evas_object_state_cow, obj->prev); | 211 | eina_cow_free(evas_object_state_cow, obj->prev); |
212 | obj->cur = NULL; | ||
213 | obj->prev = NULL; | ||
214 | obj->map = NULL; | ||
215 | obj->proxy = NULL; | ||
197 | eo_data_unref(eo_obj, obj->private_data); | 216 | eo_data_unref(eo_obj, obj->private_data); |
198 | obj->private_data = NULL; | 217 | obj->private_data = NULL; |
199 | eo_manual_free(eo_obj); | 218 | eo_manual_free(eo_obj); |