e_compositor: add mutex for protecting destroyed surface 93/299993/1
authorJihoon Kim <jihoon48.kim@samsung.com>
Fri, 13 Oct 2023 06:36:22 +0000 (15:36 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Fri, 13 Oct 2023 08:49:56 +0000 (17:49 +0900)
Change-Id: I7225630967de999e57ccf7d0a3015f0c2dbecee3
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
src/bin/e_compositor.c

index 260279b..bdf7090 100644 (file)
@@ -503,6 +503,8 @@ _e_surface_destroy(E_Surface *surface)
 {
    struct wl_resource *cb;
 
+   g_mutex_lock(&surface->base.surface_mutex);
+
    if (surface->base.reparented)
      {
         /* reset pixmap parent window */
@@ -554,6 +556,10 @@ _e_surface_destroy(E_Surface *surface)
 
    e_client_hook_del(surface->client_del_hook);
 
+   g_mutex_unlock(&surface->base.surface_mutex);
+
+   g_mutex_clear(&surface->base.surface_mutex);
+
    surface->ec->comp_data = NULL;
    e_object_unref(E_OBJECT(surface->ec));
    free(surface);
@@ -999,7 +1005,6 @@ _e_surface_cb_client_del(void *data, E_Client *ec)
    TRACE_DS_BEGIN(COMP_WL:CLIENT DEL CB);
 
    g_mutex_clear(&ec->comp_data->last_device_kbd_mutex);
-   g_mutex_clear(&ec->comp_data->surface_mutex);
 
    e_comp_wl_hook_call(E_COMP_WL_HOOK_DEL, ec);