remove the link of wl_resource destory listener 02/144302/2
authorSangjin Lee <lsj119@samsung.com>
Wed, 16 Aug 2017 07:31:11 +0000 (16:31 +0900)
committerDoyoun Kang <doyoun.kang@samsung.com>
Wed, 16 Aug 2017 10:12:39 +0000 (10:12 +0000)
wl_resource was use the wl_priv_signal for destroy signal from new version of wayland.
unlike the wl_signal, the link of signal should be removed in the destory callback function.
If not, it could the cause of memory crash when instance of link was freed without unlink
in the destroy callback.

Change-Id: Id98e0c6262adbf6c9b3df6f272ab11a199cefb4c

src/bin/e_comp_object.c
src/bin/e_comp_wl_rsm.c
src/bin/e_policy_conformant.c
src/bin/e_policy_wl.c

index 5de1873..df2883f 100644 (file)
@@ -4213,7 +4213,12 @@ _e_comp_object_cb_buffer_destroy(struct wl_listener *listener, void *data EINA_U
    E_Comp_Object *cw;
    cw = container_of(listener, E_Comp_Object, buffer_destroy_listener);
 
-   cw->buffer_destroy_listener.notify = NULL;
+   if (cw->buffer_destroy_listener.notify)
+     {
+        cw->buffer_destroy_listener.notify = NULL;
+        wl_list_remove(&cw->buffer_destroy_listener.link);
+     }
+
    if (e_object_is_del(E_OBJECT(cw->ec)))
      {
         if (!e_object_delay_del_ref_get(E_OBJECT(cw->ec)))
index 7e8e5a8..5d1ba8c 100644 (file)
@@ -1667,6 +1667,12 @@ _remote_surface_cb_tbm_destroy(struct wl_listener *listener, void *data)
    remote_surface = container_of(listener, E_Comp_Wl_Remote_Surface, tbm_destroy_listener);
    if (!remote_surface) return;
 
+   if (remote_surface->tbm_destroy_listener.notify)
+     {
+        wl_list_remove(&remote_surface->tbm_destroy_listener.link);
+        remote_surface->tbm_destroy_listener.notify = NULL;
+     }
+
    remote_surface->wl_tbm = NULL;
 }
 
@@ -2762,6 +2768,12 @@ _e_comp_wl_remote_buffer_cb_destroy(struct wl_listener *listener, void *data)
    remote_buffer = container_of(listener, E_Comp_Wl_Remote_Buffer, destroy_listener);
    if (!remote_buffer) return;
 
+   if (remote_buffer->destroy_listener.notify)
+     {
+        wl_list_remove(&remote_buffer->destroy_listener.link);
+        remote_buffer->destroy_listener.notify = NULL;
+     }
+
    e_comp_wl_buffer_reference(&remote_buffer->ref, NULL);
    free(remote_buffer);
 }
index 5a5a44d..842c3a6 100644 (file)
@@ -407,6 +407,11 @@ _conf_client_resource_destroy(struct wl_listener *listener, void *data)
    if (!cres)
      return;
 
+   if (cres->destroy_listener.notify)
+     {
+        wl_list_remove(&cres->destroy_listener.link);
+        cres->destroy_listener.notify = NULL;
+     }
    DBG("Destroy Wl Resource res %p owner %s(%p)",
          cres->res, cres->cfc->ec->icccm.name ? cres->cfc->ec->icccm.name : "", cres->cfc->ec);
 
index 684cbae..f8c5e8e 100644 (file)
@@ -3887,6 +3887,11 @@ _tzsh_reg_cb_shell_destroy(struct wl_listener *listener, void *data)
    E_Policy_Wl_Tzsh_Region *tzsh_reg;
 
    tzsh_reg = container_of(listener, E_Policy_Wl_Tzsh_Region, destroy_listener);
+   if (tzsh_reg->destroy_listener.notify)
+     {
+        wl_list_remove(&tzsh_reg->destroy_listener.link);
+        tzsh_reg->destroy_listener.notify = NULL;
+     }
 
    if (tzsh_reg->res_tzsh_reg)
      {