discomfitor pushed a commit to branch master.

http://git.enlightenment.org/core/enlightenment.git/commit/?id=b98854b17bfb5f81f78e6551721176626793bfc7

commit b98854b17bfb5f81f78e6551721176626793bfc7
Author: Mike Blumenkrantz <zm...@osg.samsung.com>
Date:   Fri Jun 9 20:18:20 2017 -0400

    remove client callback from luncher icon when necessary
    
    ==20443== Invalid read of size 8
    ==20443==    at 0x28CED526: _bar_exec_new_show (bar.c:980)
    ==20443==    by 0x819D78D: _eo_evas_object_cb (evas_callbacks.c:184)
    ==20443==    by 0xDFB6FED: _event_callback_call (eo_base_class.c:1496)
    ==20443==    by 0xDFB7373: _efl_object_event_callback_legacy_call 
(eo_base_class.c:1569)
    ==20443==    by 0xDFB743A: efl_event_callback_legacy_call 
(eo_base_class.c:1572)
    ==20443==    by 0x81DC562: 
_efl_canvas_object_efl_object_event_callback_legacy_call 
(evas_object_main.c:993)
    ==20443==    by 0xDFB743A: efl_event_callback_legacy_call 
(eo_base_class.c:1572)
    ==20443==    by 0x819E1F8: evas_object_event_callback_call 
(evas_callbacks.c:404)
    ==20443==    by 0x81E6B23: evas_object_inform_call_show 
(evas_object_inform.c:13)
    ==20443==    by 0x81DECA2: _show (evas_object_main.c:1689)
    ==20443==    by 0x81DF0E7: _efl_canvas_object_efl_gfx_visible_set 
(evas_object_main.c:1810)
    ==20443==    by 0xDD670B9: efl_gfx_visible_set (efl_gfx.eo.c:21)
    ==20443==    by 0x81DEA93: evas_object_show (evas_object_main.c:1639)
    ==20443==    by 0x483706: _e_comp_intercept_show_helper 
(e_comp_object.c:1754)
    ==20443==    by 0x483761: _e_comp_intercept_show (e_comp_object.c:1768)
    ==20443==    by 0x81E7536: evas_object_intercept_call_show 
(evas_object_intercept.c:71)
    ==20443==    by 0x81E7ED2: _evas_object_intercept_call_internal 
(evas_object_intercept.c:103)
    ==20443==    by 0x81E88B0: _evas_object_intercept_call_evas 
(evas_object_intercept.c:236)
    ==20443==    by 0x81DF0CA: _efl_canvas_object_efl_gfx_visible_set 
(evas_object_main.c:1807)
    ==20443==    by 0xDD670B9: efl_gfx_visible_set (efl_gfx.eo.c:21)
    ==20443==    by 0x81DEA93: evas_object_show (evas_object_main.c:1639)
    ==20443==    by 0x4A6793: _e_desk_show_begin (e_desk.c:821)
    ==20443==    by 0x4A4E39: e_desk_show (e_desk.c:312)
    ==20443==    by 0x537C2E: _e_int_menus_clients_item_cb (e_int_menus.c:1624)
    ==20443==    by 0x548D3F: _e_menu_active_call (e_menu.c:2056)
    ==20443==    by 0x54ABFB: _e_menu_cb_mouse_up (e_menu.c:2789)
    ==20443==    by 0xC636B66: _ecore_call_handler_cb (ecore_private.h:325)
    ==20443==    by 0xC637B3F: _ecore_event_call (ecore_events.c:518)
    ==20443==    by 0xC641158: _ecore_main_loop_iterate_internal 
(ecore_main.c:2397)
    ==20443==    by 0xC63EC7E: ecore_main_loop_begin (ecore_main.c:1299)
    ==20443==    by 0x43DE81: main (e_main.c:1081)
    ==20443==  Address 0x20 is not stack'd, malloc'd or (recently) free'd
---
 src/modules/luncher/bar.c     | 33 +++++++++++++++++++++++++++++++--
 src/modules/luncher/luncher.h |  1 +
 2 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/src/modules/luncher/bar.c b/src/modules/luncher/bar.c
index 636824641..e0b85c7c5 100644
--- a/src/modules/luncher/bar.c
+++ b/src/modules/luncher/bar.c
@@ -3,6 +3,7 @@ static Eina_List *handlers;
 static Eina_Bool _bar_icon_preview_show(void *data);
 static Eina_Bool _bar_icon_preview_hide(void *data);
 static void      _bar_icon_del(Instance *inst, Icon *ic);
+static void _bar_exec_new_show(void *data, Evas *e, Evas_Object *obj, void 
*event_data);
 
 static float
 _bar_size_calc(Instance *inst)
@@ -187,6 +188,11 @@ _bar_icon_match(Instance *inst, E_Client *ec)
           {
              ic2->execs = eina_list_remove(ic2->execs, ec->exe_inst);
              ic2->clients = eina_list_remove(ic2->clients, ec);
+             if (ic2->client_cbs)
+               {
+                  ic2->client_cbs = eina_list_remove(ic2->client_cbs, ec);
+                  evas_object_event_callback_del_full(ec->frame, 
EVAS_CALLBACK_SHOW, _bar_exec_new_show, ic2);
+               }
              if (!eina_list_count(ic2->execs) && 
!eina_list_count(ic2->clients))
                {
                   eina_hash_del(inst->icons_clients_hash, ec, ic2);
@@ -236,6 +242,8 @@ _bar_instance_watch(void *data, E_Exec_Instance *ex, 
E_Exec_Watch_Type type)
 static void
 _bar_icon_del(Instance *inst, Icon *ic)
 {
+   E_Client *ec;
+
    inst->icons = eina_list_remove(inst->icons, ic);
    if (ic->preview)
      _bar_icon_preview_hide(ic);
@@ -250,6 +258,8 @@ _bar_icon_del(Instance *inst, Icon *ic)
      efreet_desktop_unref(ic->desktop);
    eina_list_free(ic->execs);
    eina_list_free(ic->clients);
+   EINA_LIST_FREE(ic->client_cbs, ec)
+     evas_object_event_callback_del_full(ec->frame, EVAS_CALLBACK_SHOW, 
_bar_exec_new_show, ic);
    eina_stringshare_del(ic->icon);
    eina_stringshare_del(ic->key);
    if (ic->exec)
@@ -987,6 +997,7 @@ _bar_exec_new_show(void *data, Evas *e EINA_UNUSED, 
Evas_Object *obj, void *even
                ic->mouse_in_timer = ecore_timer_loop_add(0.3, 
_bar_icon_preview_show, ic);
           }
      }
+   ic->client_cbs = eina_list_remove(ic->client_cbs, ec);
    evas_object_event_callback_del_full(ec->frame, EVAS_CALLBACK_SHOW, 
_bar_exec_new_show, ic);
 }
 
@@ -1299,6 +1310,11 @@ _bar_cb_client_remove(void *data EINA_UNUSED, int type 
EINA_UNUSED, E_Event_Clie
              if (ic->starting) elm_layout_signal_emit(ic->o_layout, 
"e,state,started", "e");
              ic->starting = EINA_FALSE;
              ic->clients = eina_list_remove(ic->clients, ev->ec);
+             if (ic->client_cbs)
+               {
+                  ic->client_cbs = eina_list_remove(ic->client_cbs, ev->ec);
+                  evas_object_event_callback_del_full(ev->ec->frame, 
EVAS_CALLBACK_SHOW, _bar_exec_new_show, ic);
+               }
              if (ev->ec->exe_inst)
                ic->execs = eina_list_remove(ic->execs, ev->ec->exe_inst);
              if (!eina_list_count(ic->execs) && !eina_list_count(ic->clients))
@@ -1351,6 +1367,11 @@ _bar_cb_exec_del(void *data EINA_UNUSED, int type 
EINA_UNUSED, E_Exec_Instance *
              ic->starting = EINA_FALSE;
              ic->execs = eina_list_remove(ic->execs, ex);
              ic->clients = eina_list_remove(ic->clients, ec);
+             if (ic->client_cbs)
+               {
+                  ic->client_cbs = eina_list_remove(ic->client_cbs, ec);
+                  evas_object_event_callback_del_full(ec->frame, 
EVAS_CALLBACK_SHOW, _bar_exec_new_show, ic);
+               }
              if (!eina_list_count(ic->execs) && !eina_list_count(ic->clients))
                {
                   snprintf(ori, sizeof(ori), "e,state,off,%s", 
_bar_location_get(inst));
@@ -1465,6 +1486,11 @@ _bar_cb_exec_client_prop(void *data EINA_UNUSED, int 
type EINA_UNUSED, E_Event_C
                ic->execs = eina_list_remove(ic->execs, ev->ec->exe_inst);
              else
                ic->clients = eina_list_remove(ic->clients, ev->ec);
+             if (ic->client_cbs)
+               {
+                  ic->client_cbs = eina_list_remove(ic->client_cbs, ev->ec);
+                  evas_object_event_callback_del_full(ev->ec->frame, 
EVAS_CALLBACK_SHOW, _bar_exec_new_show, ic);
+               }
              if (!eina_list_count(ic->execs) && !eina_list_count(ic->clients))
                {
                   if (ic->preview)
@@ -1539,8 +1565,11 @@ _bar_cb_exec_new(void *data EINA_UNUSED, int type, 
E_Exec_Instance *ex)
              if (evas_object_visible_get(ec->frame))
                _bar_exec_new_show(ic, NULL, ec->frame, NULL);
              else
-               evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_SHOW,
-                   _bar_exec_new_show, ic);
+               {
+                  ic->client_cbs = eina_list_append(ic->client_cbs, ec);
+                  evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_SHOW,
+                    _bar_exec_new_show, ic);
+               }
           }
         else
           {
diff --git a/src/modules/luncher/luncher.h b/src/modules/luncher/luncher.h
index 8019eab80..e2b7037e9 100644
--- a/src/modules/luncher/luncher.h
+++ b/src/modules/luncher/luncher.h
@@ -84,6 +84,7 @@ struct _Icon
    Efreet_Desktop   *desktop;
    Eina_List        *execs;
    Eina_List        *clients;
+   Eina_List        *client_cbs;
    Ecore_Timer      *mouse_in_timer;
    Ecore_Timer      *mouse_out_timer;
    Ecore_Timer      *drag_timer;

-- 


Reply via email to