1. if window is transient for another.. if parent del - nuke reference to it

in transient.
2. addd flush button in genlist test - for exposing memory issues.



SVN revision: 47757
This commit is contained in:
Carsten Haitzler 2010-04-05 04:58:43 +00:00
parent 6d3534b6f8
commit 31c4f0349c
2 changed files with 43 additions and 4 deletions

View File

@ -312,6 +312,16 @@ my_gl_last(void *data, Evas_Object *obj, void *event_info)
elm_genlist_item_selected_set(gli, 1);
}
static void
my_gl_flush(void *data, Evas_Object *obj, void *event_info)
{
Evas_Object *gl = data;
evas_image_cache_flush(evas_object_evas_get(obj));
evas_font_cache_flush(evas_object_evas_get(obj));
edje_file_cache_flush();
edje_collection_cache_flush();
}
void
test_genlist2(void *data, Evas_Object *obj, void *event_info)
{
@ -466,6 +476,14 @@ test_genlist2(void *data, Evas_Object *obj, void *event_info)
elm_box_pack_end(bx3, bt);
evas_object_show(bt);
bt = elm_button_add(win);
elm_button_label_set(bt, "Flush");
evas_object_smart_callback_add(bt, "clicked", my_gl_flush, gl);
evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
elm_box_pack_end(bx3, bt);
evas_object_show(bt);
elm_box_pack_end(bx, bx3);
evas_object_show(bx3);

View File

@ -29,6 +29,7 @@ struct _Elm_Win
static const char *widtype = NULL;
static void _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _elm_win_obj_callback_parent_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _elm_win_obj_intercept_show(void *data, Evas_Object *obj);
static void _elm_win_move(Ecore_Evas *ee);
static void _elm_win_resize(Ecore_Evas *ee);
@ -111,6 +112,12 @@ _elm_win_obj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void
Elm_Win *win = data;
Evas_Object *child;
if (win->parent)
{
evas_object_event_callback_del_full(win->parent, EVAS_CALLBACK_DEL,
_elm_win_obj_callback_parent_del, win);
win->parent = NULL;
}
if (win->autodel_clear) *(win->autodel_clear) = -1;
_elm_win_list = eina_list_remove(_elm_win_list, win->win_obj);
while (win->subobjs) elm_win_resize_object_del(obj, win->subobjs->data);
@ -128,11 +135,11 @@ _elm_win_obj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void
{
evas_object_del(child);
}
evas_image_cache_flush(win->evas);
evas_font_cache_flush(win->evas);
// FIXME: Why are we flushing edje on every window destroy ??
edje_file_cache_flush();
edje_collection_cache_flush();
// evas_image_cache_flush(win->evas);
// evas_font_cache_flush(win->evas);
// edje_file_cache_flush();
// edje_collection_cache_flush();
// FIXME: we are in the del handler for the object and delete the canvas
// that lives under it from the handler... nasty. deferring doesnt help either
ecore_job_add(_deferred_ecore_evas_free, win->ee);
@ -142,10 +149,21 @@ _elm_win_obj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void
if ((!_elm_win_list) &&
(elm_policy_get(ELM_POLICY_QUIT) == ELM_POLICY_QUIT_LAST_WINDOW_CLOSED))
{
evas_image_cache_flush(e);
evas_font_cache_flush(e);
edje_file_cache_flush();
edje_collection_cache_flush();
elm_exit();
}
}
static void
_elm_win_obj_callback_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
{
Elm_Win *win = data;
if (obj == win->parent) win->parent = NULL;
}
static void
_elm_win_obj_intercept_show(void *data __UNUSED__, Evas_Object *obj)
{
@ -445,6 +463,9 @@ elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
win->type = type;
win->parent = parent;
if (win->parent)
evas_object_event_callback_add(win->parent, EVAS_CALLBACK_DEL,
_elm_win_obj_callback_parent_del, win);
win->evas = ecore_evas_get(win->ee);
win->win_obj = elm_widget_add(win->evas);