raster pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=eb6af1f1ff7ee069eff8bab13c0eed5010ef5660

commit eb6af1f1ff7ee069eff8bab13c0eed5010ef5660
Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com>
Date:   Sun Nov 3 21:43:11 2013 +0900

    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.
---
 src/lib/evas/canvas/evas_clip.c        | 20 ++++++++++++--------
 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 76cddc0..5dfbc48 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)
 {
    Evas_Object_Protected_Data *obj = _pd;
 
+   if (!obj->cur) return;
    if (!obj->cur->clipper) return;
 
    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)
           {
              EINA_COW_STATE_WRITE_BEGIN(obj->cur->clipper, state_write, cur)
                {
-                  state_write->have_clipees = 0;
+                  if (state_write) state_write->have_clipees = 0;
                }
              EINA_COW_STATE_WRITE_END(obj->cur->clipper, state_write, cur);
 
@@ -417,14 +418,17 @@ _clip_unset(Eo *eo_obj, void *_pd, va_list *list 
EINA_UNUSED)
    if ((!obj->is_smart) &&
        (!((obj->map->cur.map) && (obj->map->cur.usemap))))
      {
-        if (evas_object_is_in_output_rect(eo_obj, obj,
+        if (obj->cur)
+          {
+             if (evas_object_is_in_output_rect(eo_obj, obj,
+                                               obj->layer->evas->pointer.x,
+                                               obj->layer->evas->pointer.y, 1, 
1))
+               evas_event_feed_mouse_move(obj->layer->evas->evas,
                                           obj->layer->evas->pointer.x,
-                                          obj->layer->evas->pointer.y, 1, 1))
-          evas_event_feed_mouse_move(obj->layer->evas->evas,
-                                     obj->layer->evas->pointer.x,
-                                     obj->layer->evas->pointer.y,
-                                     obj->layer->evas->last_timestamp,
-                                     NULL);
+                                          obj->layer->evas->pointer.y,
+                                          obj->layer->evas->last_timestamp,
+                                          NULL);
+          }
      }
    evas_object_clip_across_check(eo_obj, obj);
 }
diff --git a/src/lib/evas/canvas/evas_object_main.c 
b/src/lib/evas/canvas/evas_object_main.c
index 27fc7ad..c779f2d 100644
--- a/src/lib/evas/canvas/evas_object_main.c
+++ b/src/lib/evas/canvas/evas_object_main.c
@@ -141,6 +141,7 @@ void
 evas_object_free(Evas_Object *eo_obj, int clean_layer)
 {
    Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, MY_CLASS);
+   Evas_Object *eo_obj2;
    if (!obj) return;
    obj->clean_layer = clean_layer;
 
@@ -171,8 +172,21 @@ evas_object_free(Evas_Object *eo_obj, int clean_layer)
         obj->func->free(eo_obj, obj, obj->private_data);
      }
    if (!was_smart_child) evas_object_release(eo_obj, obj, obj->clean_layer);
-   if (obj->clip.clipees)
-     eina_list_free(obj->clip.clipees);
+   EINA_LIST_FREE(obj->clip.clipees, eo_obj2)
+     {
+        Evas_Object_Protected_Data *obj2 = 
+          eo_data_scope_get(eo_obj2, MY_CLASS);
+        if ((obj2) && (obj2->cur))
+          {
+             EINA_COW_STATE_WRITE_BEGIN(obj2, state_write, cur)
+               {
+                  state_write->clipper = NULL;
+               }
+             EINA_COW_STATE_WRITE_END(obj2, state_write, cur);
+          }
+     }
+//   if (obj->clip.clipees)
+//     obj->clip.clipees = eina_list_free(obj->clip.clipees);
    obj->clip.cache_clipees_answer = 
eina_list_free(obj->clip.cache_clipees_answer);
    evas_object_clip_changes_clean(eo_obj);
    evas_object_event_callback_all_del(eo_obj);
@@ -188,12 +202,17 @@ evas_object_free(Evas_Object *eo_obj, int clean_layer)
      }
    if (obj->size_hints)
      {
-       EVAS_MEMPOOL_FREE(_mp_sh, obj->size_hints);
+        EVAS_MEMPOOL_FREE(_mp_sh, obj->size_hints);
+        obj->size_hints = NULL;
      }
    eina_cow_free(evas_object_proxy_cow, obj->proxy);
    eina_cow_free(evas_object_map_cow, obj->map);
    eina_cow_free(evas_object_state_cow, obj->cur);
    eina_cow_free(evas_object_state_cow, obj->prev);
+   obj->cur = NULL;
+   obj->prev = NULL;
+   obj->map = NULL;
+   obj->proxy = NULL;
    eo_data_unref(eo_obj, obj->private_data);
    obj->private_data = NULL;
    eo_manual_free(eo_obj);

-- 


Reply via email to