remove the link of wl_resource and wl_client destory listener 14/144314/2
authorSangjin Lee <lsj119@samsung.com>
Wed, 16 Aug 2017 08:08:40 +0000 (17:08 +0900)
committerSung-Jin Park <sj76.park@samsung.com>
Wed, 16 Aug 2017 08:18:25 +0000 (08:18 +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: Ieaa04e69eade4fd4a61da6a79d303a96546370d3

src/lib/desktop-shell/shell.c
src/lib/pepper/buffer.c

index d9bc2e4..33301a2 100644 (file)
@@ -57,6 +57,7 @@ handle_shell_client_destroy(struct wl_listener *listener, void *data)
        shell_client_t *shell_client = pepper_container_of(listener, shell_client,
                                                                   client_destroy_listener);
 
+       wl_list_remove(&listener->link);
        remove_ping_timer(shell_client);
        pepper_list_remove(&shell_client->link);
        free(shell_client);
index 654b0a0..bc6705a 100644 (file)
@@ -33,6 +33,8 @@ buffer_resource_destroy_handler(struct wl_listener *listener, void *data)
 {
        pepper_buffer_t *buffer = pepper_container_of(listener, buffer,
                                                          resource_destroy_listener);
+
+       wl_list_remove(&listener->link);
        pepper_object_fini(&buffer->base);
        free(buffer);
 }