From e520c4f5199a3e37d28310a16151a81780c1d2b5 Mon Sep 17 00:00:00 2001 From: ChunEon Park Date: Fri, 22 Nov 2013 19:48:24 +0900 Subject: [PATCH] elementary/mapbuf - reset the mapbuf correctly when the content is removed(unset) When the content is removed(or unset) the mapbuf didn't clean up the some stuff such as removing event callback for the content. So the unset content would be tracked still by mapbuf dangling callbacks. --- legacy/elementary/ChangeLog | 5 +++++ legacy/elementary/NEWS | 1 + legacy/elementary/src/lib/elm_mapbuf.c | 37 ++++++++++++++++++---------------- 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/legacy/elementary/ChangeLog b/legacy/elementary/ChangeLog index c7c7dee..1f88e37 100644 --- a/legacy/elementary/ChangeLog +++ b/legacy/elementary/ChangeLog @@ -1747,3 +1747,8 @@ 2013-11-05 Amitesh Singh (_ami_) * hoversel: Added focus support on hoversel items. + +2013-11-22 ChunEon Park (Hermet) + + * mapbuf: reset the mapbuf internals correctly when the content is + removed(unset) diff --git a/legacy/elementary/NEWS b/legacy/elementary/NEWS index a4029a9..687bb32 100644 --- a/legacy/elementary/NEWS +++ b/legacy/elementary/NEWS @@ -309,6 +309,7 @@ Fixes: * ctxpopup: fix elm_object_content_unset didn't unpack content from box * scroller : fix the scroller to locate the current page correctly in case that the scroller is suddenly resized and then the drag couldn't capture the page location. * scroller: don't focus region show if the scroller is disabled. + * mapbuf: reset the mapbuf internal states correclty when the content is removed(unset) Removals: diff --git a/legacy/elementary/src/lib/elm_mapbuf.c b/legacy/elementary/src/lib/elm_mapbuf.c index 59c8460..7a574bc 100644 --- a/legacy/elementary/src/lib/elm_mapbuf.c +++ b/legacy/elementary/src/lib/elm_mapbuf.c @@ -56,6 +56,24 @@ _changed_size_hints_cb(void *data, } static void +_elm_mapbuf_content_unset(Elm_Mapbuf_Smart_Data *sd, Evas_Object *obj, + Evas_Object *content) +{ + ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); + + evas_object_data_del(content, "_elm_leaveme"); + evas_object_smart_member_del(content); + evas_object_clip_unset(content); + evas_object_color_set(wd->resize_obj, 0, 0, 0, 0); + evas_object_event_callback_del_full + (content, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints_cb, + obj); + sd->content = NULL; + _sizing_eval(obj); + ELM_SAFE_FREE(sd->idler, ecore_idler_del); +} + +static void _elm_mapbuf_smart_sub_object_del(Eo *obj, void *_pd, va_list *list) { Elm_Mapbuf_Smart_Data *sd = _pd; @@ -68,17 +86,7 @@ _elm_mapbuf_smart_sub_object_del(Eo *obj, void *_pd, va_list *list) if (!int_ret) return; if (sobj == sd->content) - { - evas_object_data_del(sobj, "_elm_leaveme"); - evas_object_smart_member_del(sobj); - evas_object_clip_unset(sobj); - evas_object_event_callback_del_full - (sobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints_cb, - obj); - sd->content = NULL; - _sizing_eval(obj); - } - + _elm_mapbuf_content_unset(sd, (Evas_Object *)obj, sobj); if (ret) *ret = EINA_TRUE; } @@ -249,19 +257,14 @@ _elm_mapbuf_smart_content_unset(Eo *obj, void *_pd, va_list *list) if (ret) *ret = NULL; Elm_Mapbuf_Smart_Data *sd = _pd; - ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); if (part && strcmp(part, "default")) return; if (!sd->content) return; content = sd->content; elm_widget_sub_object_del(obj, content); - evas_object_smart_member_del(content); - evas_object_data_del(content, "_elm_leaveme"); - evas_object_color_set(wd->resize_obj, 0, 0, 0, 0); - sd->content = NULL; + _elm_mapbuf_content_unset(sd, obj, content); if (ret) *ret = content; - ELM_SAFE_FREE(sd->idler, ecore_idler_del); } static void -- 2.7.4