edje: fix crash issue when Edje tries to clean up fade object 01/120401/1
authorYoungbok Shin <youngb.shin@samsung.com>
Wed, 22 Mar 2017 05:36:38 +0000 (14:36 +0900)
committerYoungbok Shin <youngb.shin@samsung.com>
Thu, 23 Mar 2017 00:31:53 +0000 (17:31 -0700)
@tizen_fix

Change-Id: Ib7a54a42826300ff74c5eac4760a10ed0942a5e4

src/lib/edje/edje_calc.c
src/lib/edje/edje_load.c
src/lib/edje/edje_private.h

index 57ef934..2dcc176 100644 (file)
@@ -4175,19 +4175,6 @@ _edje_real_part_text_fade_image_set(Edje *ed EINA_UNUSED, Edje_Real_Part *ep, do
 }
 
 static void
-_real_part_object_del_cb_for_fade_object(void *data,
-                                         Evas *e EINA_UNUSED,
-                                         Evas_Object *obj EINA_UNUSED,
-                                         void *event_info EINA_UNUSED)
-{
-   Edje_Real_Part *ep = (Edje_Real_Part *)data;
-
-   if (ep->typedata.text->fade.object)
-     evas_object_del(ep->typedata.text->fade.object);
-   ep->typedata.text->fade.object = NULL;
-}
-
-static void
 _real_part_object_move_cb_for_fade_object(void *data,
                                          Evas *e EINA_UNUSED,
                                          Evas_Object *obj EINA_UNUSED,
@@ -4195,7 +4182,7 @@ _real_part_object_move_cb_for_fade_object(void *data,
 {
    Edje_Real_Part *ep = (Edje_Real_Part *)data;
 
-   if (ep->typedata.text->fade.object)
+   if (ep->typedata.text && ep->typedata.text->fade.object)
      {
         Evas_Coord x, y;
 
@@ -4204,6 +4191,21 @@ _real_part_object_move_cb_for_fade_object(void *data,
      }
 }
 
+/* TIZEN_ONLY(20170322): fix crash issue when Edje tries to clean up fade object */
+void
+_edje_fade_ellipsis_remove(Edje_Real_Part *ep)
+{
+   if (!ep || !ep->typedata.text) return;
+   if (!ep->typedata.text->fade.object) return;
+
+   if (ep->object)
+     evas_object_event_callback_del_full(ep->object, EVAS_CALLBACK_MOVE, _real_part_object_move_cb_for_fade_object, ep);
+
+   evas_object_del(ep->typedata.text->fade.object);
+   ep->typedata.text->fade.object = NULL;
+}
+/* END */
+
 static void
 _edje_fade_ellipsis_apply(Edje *ed, Edje_Real_Part *ep,
                           Edje_Calc_Params *pf,
@@ -4288,7 +4290,6 @@ _edje_fade_ellipsis_apply(Edje *ed, Edje_Real_Part *ep,
         evas_object_pass_events_set(ep->typedata.text->fade.object, 1);
         evas_object_pointer_mode_set(ep->typedata.text->fade.object, EVAS_OBJECT_POINTER_MODE_NOGRAB);
         evas_object_smart_member_add(ep->typedata.text->fade.object, ed->obj);
-        evas_object_event_callback_add(ep->object, EVAS_CALLBACK_DEL, _real_part_object_del_cb_for_fade_object, ep);
         evas_object_event_callback_add(ep->object, EVAS_CALLBACK_MOVE, _real_part_object_move_cb_for_fade_object, ep);
 
         ep->typedata.text->fade.align = -1;
index cfd93a3..0def4c1 100644 (file)
@@ -1591,6 +1591,9 @@ _edje_file_del(Edje *ed, Eina_Bool reuse_ic)
                   eina_stringshare_del(rp->typedata.text->font);
                   eina_stringshare_del(rp->typedata.text->cache.in_str);
                   eina_stringshare_del(rp->typedata.text->cache.out_str);
+                  /* TIZEN_ONLY(20170322): fix crash issue when Edje tries to clean up fade object */
+                  _edje_fade_ellipsis_remove(rp);
+                  /* END */
                   free(rp->typedata.text);
                }
              else if ((rp->type == EDJE_RP_TYPE_SWALLOW) &&
index 1970d9a..2fafeeb 100644 (file)
@@ -3066,6 +3066,9 @@ Evas_Event_Flags _edje_real_part_ignore_flags_get(Edje *ed, Edje_Real_Part *rp);
 void _edje_real_part_ignore_flags_set(Edje *ed, Edje_Real_Part *rp, Evas_Event_Flags ignore_flags);
 Evas_Event_Flags _edje_real_part_mask_flags_get(Edje *ed, Edje_Real_Part *rp);
 void _edje_real_part_mask_flags_set(Edje *ed, Edje_Real_Part *rp, Evas_Event_Flags mask_flags);
+/* TIZEN_ONLY(20170322): fix crash issue when Edje tries to clean up fade object */
+void _edje_fade_ellipsis_remove(Edje_Real_Part *ep);
+/* END */
 
 #ifdef HAVE_LIBREMIX
 #include <remix/remix.h>