elementary/mapbuf - reset the mapbuf correctly when the content is removed(unset)
authorChunEon Park <hermet@hermet.pe.kr>
Fri, 22 Nov 2013 10:48:24 +0000 (19:48 +0900)
committerChunEon Park <hermet@hermet.pe.kr>
Fri, 22 Nov 2013 10:48:24 +0000 (19:48 +0900)
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.

ChangeLog
NEWS
src/lib/elm_mapbuf.c

index c7c7dee47f5a67eaf3a48839a2b7afa54178f32a..1f88e378e8b25fb0e38dc3bc2a82a7486ab6dca6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
 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/NEWS b/NEWS
index a4029a9661a369c65fc1c9fdbaebc218ef2d8a69..687bb325a743c8b12892dfce9bbbca79450a3c91 100644 (file)
--- a/NEWS
+++ b/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:
 
index 59c84602211859685db66235d76b3d28997064d7..7a574bc8ecff50a116284170bfefc76d1649d597 100644 (file)
@@ -55,6 +55,24 @@ _changed_size_hints_cb(void *data,
    _sizing_eval(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)
 {
@@ -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