client: add checking null of wl_buffer 22/284122/3
authorChangyeon Lee <cyeon.lee@samsung.com>
Thu, 10 Nov 2022 03:39:57 +0000 (12:39 +0900)
committerChangyeon Lee <cyeon.lee@samsung.com>
Thu, 10 Nov 2022 05:25:23 +0000 (14:25 +0900)
wl_buffer can be null in below case.

1. client get wl_buffer from event of wayland_tbm protocol
2. read event and wl_closure of buffer_destroy event is created
3. wl_proxy_destroy(wl_buffer) is called
4. WL_PROXY_FLAG_DESTROYED flag is set to wl_proxy(wl_buffer)
5. dispatch event of wl_closure of buffer_destroy event
6. wayland library call event handle with null of wl_buffer
   because WL_PROXY_FLAG_DESTROYED flag is set

Change-Id: I6c4cba4209fa6885b62dd9e5b141f92b40aac653

src/wayland-tbm-client.c

index 91a6d0e724d28d94dafdb90729bce1160fa12ecb..a43c93fa690671eb1750df731419182ebada0406 100644 (file)
@@ -253,6 +253,8 @@ handle_buffer_destroy(void *data,
 
        WL_TBM_TRACE("wl_buffer:%p", wl_buffer);
 
+       if (!wl_buffer) return;
+
        buffer = _wayland_tbm_client_find_tbm_buffer_wl_buffer(tbm_client, wl_buffer);
        if (buffer)
                buffer->wl_buffer = NULL;