e_policy_visiblity: fix leak 69/217569/3
authorJuyeon Lee <juyeonne.lee@samsung.com>
Tue, 12 Nov 2019 11:09:16 +0000 (20:09 +0900)
committerJuyeon Lee <juyeonne.lee@samsung.com>
Fri, 29 Nov 2019 00:54:31 +0000 (09:54 +0900)
E_Vis_Client allocation and free is not paired due missing in
client delete hook and event handler
the EVENT_CLIENT_REMOVE is made in pair with E_EVENT_CLIENT_ADD
but, sometimes new_client don't made E_EVENT_CLIENT_ADD and tried to delete
and it leads leak as a result

Use only E_CLIENT_HOOK_DEL for consistanccy

Change-Id: Ic4c7ae3fbda9c14f321ca1969fd57f7690e3643d

src/bin/e_policy_visibility.c

index fddcf81..44982f5 100644 (file)
@@ -1836,7 +1836,7 @@ _e_vis_hook_new_client_post(void *data EINA_UNUSED, E_Client *ec)
 }
 
 static void
-_e_vis_client_remove(E_Client *ec)
+_e_vis_hook_client_del(void *data EINA_UNUSED, E_Client *ec)
 {
    E_VIS_CLIENT_GET_OR_RETURN(vc, ec);
    eina_hash_del_by_key(pol_vis->clients_hash, &ec);
@@ -1849,24 +1849,6 @@ _e_vis_client_remove(E_Client *ec)
 }
 
 static void
-_e_vis_hook_client_del(void *data EINA_UNUSED, E_Client *ec)
-{
-   if (!ec->new_client) return;
-   _e_vis_client_remove(ec);
-}
-
-static Eina_Bool
-_e_vis_cb_client_remove(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
-{
-   E_Event_Client *ev;
-
-   ev = event;
-   _e_vis_client_remove(ev->ec);
-
-   return ECORE_CALLBACK_PASS_ON;
-}
-
-static void
 _e_vis_cb_child_launch_done(void *data, Evas_Object *obj, const char *signal, const char *source)
 {
    E_Vis_Client *vc;
@@ -2055,8 +2037,6 @@ _e_vis_event_init(void)
    E_LIST_HOOK_APPEND(pol_vis->hooks, E_CLIENT_HOOK_NEW_CLIENT_POST, _e_vis_hook_new_client_post, NULL);
    E_LIST_HOOK_APPEND(pol_vis->hooks, E_CLIENT_HOOK_DEL, _e_vis_hook_client_del, NULL);
 
-   E_LIST_HANDLER_APPEND(pol_vis->handlers, E_EVENT_CLIENT_REMOVE,   _e_vis_cb_client_remove, NULL);
-
    E_COMP_OBJECT_INTERCEPT_HOOK_APPEND(pol_vis->interceptors, E_COMP_OBJECT_INTERCEPT_HOOK_SHOW_HELPER,  _e_vis_intercept_show, NULL);
    E_COMP_OBJECT_INTERCEPT_HOOK_APPEND(pol_vis->interceptors, E_COMP_OBJECT_INTERCEPT_HOOK_HIDE,         _e_vis_intercept_hide, NULL);