From c74f2f3db540d7d7ea447d1d61ec9ce8225c2202 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 5 Dec 2011 04:26:32 +0000 Subject: [PATCH] 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)! SVN revision: 65884 --- legacy/elementary/src/lib/elm_widget.c | 2 +- legacy/elementary/src/lib/elm_win.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/legacy/elementary/src/lib/elm_widget.c b/legacy/elementary/src/lib/elm_widget.c index 248691ef3d..e904410d37 100644 --- a/legacy/elementary/src/lib/elm_widget.c +++ b/legacy/elementary/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/legacy/elementary/src/lib/elm_win.c b/legacy/elementary/src/lib/elm_win.c index 367089dd17..2df4827a6a 100644 --- a/legacy/elementary/src/lib/elm_win.c +++ b/legacy/elementary/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); }