edje: fix big oopsie.
authorcedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 14 Jun 2012 01:20:26 +0000 (01:20 +0000)
committercedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 14 Jun 2012 01:20:26 +0000 (01:20 +0000)
NOTE: this should unbreak your use of E17 clock widget
and elm_list should still be fine.

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/edje@72097 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/edje_load.c
src/lib/edje_private.h
src/lib/edje_util.c

index 4daef47..21f8ded 100644 (file)
@@ -867,10 +867,13 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g
 
                   EINA_LIST_FREE(collect, eud)
                     {
+                       Evas_Object *child = NULL;
+
                        switch (eud->type)
                          {
                           case EDJE_USER_SWALLOW:
                              edje_object_part_swallow(obj, eud->part, eud->u.swallow.child);
+                             child = eud->u.swallow.child;
                              break;
                           case EDJE_USER_BOX_PACK:
                              boxes = eina_list_append(boxes, eud);
@@ -880,6 +883,7 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g
                              edje_object_part_table_pack(obj, eud->part, eud->u.table.child,
                                                          eud->u.table.col, eud->u.table.row,
                                                          eud->u.table.colspan, eud->u.table.rowspan);
+                             child = eud->u.table.child;
                              break;
                           case EDJE_USER_DRAG_STEP:
                              edje_object_part_drag_step_set(obj, eud->part,
@@ -906,14 +910,14 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g
                              eina_stringshare_del(eud->u.string.text);
                              break;
                          }
-                       if (eud) _edje_user_definition_free(eud);
+                       if (eud) _edje_user_definition_remove(eud, child);
                     }
 
                   boxes = eina_list_sort(boxes, -1, _sort_defined_boxes);
                   EINA_LIST_FREE(boxes, eud)
                     {
                        edje_object_part_box_append(obj, eud->part, eud->u.box.child);
-                       _edje_user_definition_free(eud);
+                       _edje_user_definition_remove(eud, eud->u.box.child);
                     }
                }
 
index 2742382..ea51b73 100644 (file)
@@ -2124,6 +2124,7 @@ Eina_Bool _edje_multisense_internal_sound_tone_play(Edje *ed, const char *tone_n
 
 void _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *state);
 
+void _edje_user_definition_remove(Edje_User_Defined *eud, Evas_Object *child);
 void _edje_user_definition_free(Edje_User_Defined *eud);
 
 #ifdef HAVE_LIBREMIX
index 47a7322..59fc8b3 100644 (file)
@@ -69,6 +69,16 @@ _edje_user_definition_new(Edje_User_Defined_Type type, const char *part, Edje *e
 }
 
 void
+_edje_user_definition_remove(Edje_User_Defined *eud, Evas_Object *child)
+{
+   eud->ed->user_defined = eina_list_remove(eud->ed->user_defined, eud);
+
+   if (child) evas_object_event_callback_del_full(child, EVAS_CALLBACK_DEL, _edje_user_def_del_cb, eud);
+   eina_stringshare_del(eud->part);
+   free(eud);
+}
+
+void
 _edje_user_definition_free(Edje_User_Defined *eud)
 {
    Evas_Object *child = NULL;
@@ -80,7 +90,8 @@ _edje_user_definition_free(Edje_User_Defined *eud)
      {
       case EDJE_USER_SWALLOW:
        child = eud->u.swallow.child;
-       edje_object_part_unswallow(eud->ed->obj, child);
+       rp = _edje_real_part_recursive_get(eud->ed, eud->part);
+       _edje_real_part_swallow_clear(rp);
        break;
       case EDJE_USER_BOX_PACK:
        child = eud->u.box.child;
@@ -100,9 +111,7 @@ _edje_user_definition_free(Edje_User_Defined *eud)
          break;
      }
 
-   if (child) evas_object_event_callback_del_full(child, EVAS_CALLBACK_DEL, _edje_user_def_del_cb, eud);
-   eina_stringshare_del(eud->part);
-   free(eud);
+   _edje_user_definition_remove(eud, child);
 }
 
 static void
@@ -2810,21 +2819,7 @@ edje_object_part_unswallow(Evas_Object *obj, Evas_Object *obj_swallow)
                }
           }
 
-       evas_object_smart_member_del(rp->swallowed_object);
-       evas_object_event_callback_del_full(rp->swallowed_object,
-                                            EVAS_CALLBACK_FREE,
-                                            _edje_object_part_swallow_free_cb,
-                                            rp->edje->obj);
-       evas_object_event_callback_del_full(rp->swallowed_object,
-                                            EVAS_CALLBACK_CHANGED_SIZE_HINTS,
-                                            _edje_object_part_swallow_changed_hints_cb,
-                                            rp);
-       evas_object_clip_unset(rp->swallowed_object);
-       evas_object_data_del(rp->swallowed_object, "\377 edje.swallowing_part");
-
-       if (rp->part->mouse_events)
-         _edje_callbacks_del(rp->swallowed_object, rp->edje);
-       _edje_callbacks_focus_del(rp->swallowed_object, rp->edje);
+        _edje_real_part_swallow_clear(rp);
 
        rp->swallowed_object = NULL;
        rp->swallow_params.min.w = 0;
@@ -4918,10 +4913,22 @@ _edje_block_violate(Edje *ed)
 void
 _edje_object_part_swallow_free_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
 {
-   Evas_Object *edje_obj;
+   Edje_Real_Part *rp;
+   Edje_User_Defined *eud;
+   Eina_List *l;
+
+   rp = data;
+
+   EINA_LIST_FOREACH(rp->edje->user_defined, l, eud)
+     if (eud->type == EDJE_USER_SWALLOW && eud->u.swallow.child == obj)
+       {
+          _edje_user_definition_free(eud);
+          break;
+       }
+
+   _edje_real_part_swallow_clear(rp);
+   rp->swallowed_object = NULL;
 
-   edje_obj = data;
-   edje_object_part_unswallow(edje_obj, obj);
    return;
 }
 
@@ -5050,9 +5057,9 @@ _edje_real_part_swallow(Edje_Real_Part *rp,
    else evas_object_clip_set(rp->swallowed_object, rp->edje->base.clipper);
    evas_object_stack_above(rp->swallowed_object, rp->object);
    evas_object_event_callback_add(rp->swallowed_object,
-                                  EVAS_CALLBACK_DEL,
+                                  EVAS_CALLBACK_FREE,
                                  _edje_object_part_swallow_free_cb,
-                                 rp->edje->obj);
+                                 rp);
    evas_object_event_callback_add(rp->swallowed_object,
                                   EVAS_CALLBACK_CHANGED_SIZE_HINTS,
                                  _edje_object_part_swallow_changed_hints_cb,
@@ -5090,7 +5097,7 @@ _edje_real_part_swallow_clear(Edje_Real_Part *rp)
    evas_object_event_callback_del_full(rp->swallowed_object,
                                        EVAS_CALLBACK_FREE,
                                        _edje_object_part_swallow_free_cb,
-                                       rp->edje->obj);
+                                       rp);
    evas_object_event_callback_del_full(rp->swallowed_object,
                                        EVAS_CALLBACK_CHANGED_SIZE_HINTS,
                                        _edje_object_part_swallow_changed_hints_cb,