From: discomfitor Date: Mon, 5 Dec 2011 04:26:32 +0000 (+0000) Subject: fix super annoying elm_win bug that went something like this: X-Git-Tag: REL_F_I9500_20120323_1~17^2~1176 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ff543cb1905bd9acbe7763976b5eb72de521e92d;p=framework%2Fuifw%2Felementary.git fix super annoying elm_win bug that went something like this: win_resize_object_add(win, subobj); object_content_set(otherobj, subobj); object_del(win); ERR<21326>:elm-externals elm_widget.c:978 elm_widget_sub_object_del() removing sub object 0xdeadbeef (some_stupid_widget) from parent 0xRRRRRRRR (win), but elm-parent is different 0xFUCKTHIS (NOT EVEN A WIDGET)! git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@65884 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/src/lib/elm_widget.c b/src/lib/elm_widget.c index 248691e..e904410 100644 --- a/src/lib/elm_widget.c +++ b/src/lib/elm_widget.c @@ -945,7 +945,7 @@ elm_widget_sub_object_add(Evas_Object *obj, _sub_obj_del); } } - + evas_object_smart_callback_call(sobj, "win-resize-del-private-dont-use-this. seriously", NULL); sd->subobjs = eina_list_append(sd->subobjs, sobj); evas_object_data_set(sobj, "elm-parent", obj); evas_object_event_callback_add(sobj, EVAS_CALLBACK_DEL, _sub_obj_del, sd); diff --git a/src/lib/elm_win.c b/src/lib/elm_win.c index 367089d..2df4827 100644 --- a/src/lib/elm_win.c +++ b/src/lib/elm_win.c @@ -1367,6 +1367,21 @@ _win_inlined_image_set(Elm_Win *win) _win_img_focus_out, win); } +static void +_subobj_del(Evas_Object *obj, Evas_Object *subobj, void *event_info __UNUSED__) +{ + Elm_Win *win = elm_widget_data_get(obj); + evas_object_event_callback_del_full(subobj, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _elm_win_subobj_callback_changed_size_hints, + obj); + evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL, + _elm_win_subobj_callback_del, obj); + win->subobjs = eina_list_remove(win->subobjs, subobj); + evas_object_smart_callback_del(subobj, "win-resize-del-private-dont-use-this. seriously", (Evas_Smart_Cb)_subobj_del); + _elm_win_eval_subobjs(obj); +} + EAPI Evas_Object * elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type) { @@ -1678,6 +1693,7 @@ elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj) evas_object_geometry_get(obj, NULL, NULL, &w, &h); evas_object_move(subobj, 0, 0); evas_object_resize(subobj, w, h); + evas_object_smart_callback_add(subobj, "win-resize-del-private-dont-use-this. seriously", (Evas_Smart_Cb)_subobj_del, obj); _elm_win_eval_subobjs(obj); }