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.

legacy/elementary/ChangeLog
legacy/elementary/NEWS
legacy/elementary/src/lib/elm_mapbuf.c

index c7c7dee..1f88e37 100644 (file)
 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)
index a4029a9..687bb32 100644 (file)
@@ -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 59c8460..7a574bc 100644 (file)
@@ -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