use new ref_get func in object cleanup for windows.
authorraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 29 Mar 2012 07:46:59 +0000 (07:46 +0000)
committerHyoyoung Chang <hyoyoung.chang@samsung.com>
Thu, 29 Mar 2012 08:55:52 +0000 (17:55 +0900)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@69723 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/elm_win.c

index 186b0ef..9b97130 100644 (file)
@@ -612,7 +612,7 @@ static void
 _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info __UNUSED__)
 {
    Elm_Win *win = data;
-   Evas_Object *child;
+   Evas_Object *child, *child2 = NULL;
 
    if (win->parent)
      {
@@ -634,15 +634,36 @@ _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_inf
    if (win->shot.timer) ecore_timer_del(win->shot.timer);
    evas_object_event_callback_del_full(win->win_obj, EVAS_CALLBACK_DEL,
                                        _elm_win_obj_callback_del, win);
-   while (((child = evas_object_bottom_get(win->evas))) &&
-          (child != obj))
+   child = evas_object_bottom_get(win->evas);
+   while (child)
      {
-        evas_object_del(child);
-     }
-   while (((child = evas_object_top_get(win->evas))) &&
-          (child != obj))
-     {
-        evas_object_del(child);
+        /* if the object we see *IS* the window object (because we are
+         * faking a parent object inside the canvas), then skip it and
+         * go to the next one */
+        if (child == obj)
+          {
+             child = evas_object_above_get(child);
+             if (!child) break;
+          }
+        /* if we are using the next object above from the previous loop */
+        if (child == child2)
+          {
+             /* this object has refcounts from the previous loop */
+             child2 = evas_object_above_get(child);
+             if (child2) evas_object_ref(child2);
+             evas_object_del(child);
+             /* so unref from previous loop */
+             evas_object_unref(child);
+             child = child2;
+          }
+        else
+          {
+             /* just delete as normal (probably only first object */
+             child2 = evas_object_above_get(child);
+             if (child2) evas_object_ref(child2);
+             evas_object_del(child);
+             child = child2;
+          }
      }
 #ifdef HAVE_ELEMENTARY_X
    if (win->client_message_handler)