From 66dfb7f49b0e18150b109a75649fc85a487f15bc Mon Sep 17 00:00:00 2001 From: Kirill Primak Date: Sat, 29 Jun 2024 15:12:44 +0300 Subject: [PATCH] xdg-shell,layer-shell: assert that configure events are only sent to initialized surfaces This helps to ensure that compositors behave correctly and don't confuse clients. --- types/wlr_layer_shell_v1.c | 5 +---- types/xdg_shell/wlr_xdg_surface.c | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/types/wlr_layer_shell_v1.c b/types/wlr_layer_shell_v1.c index b6181c6dc..2d8384981 100644 --- a/types/wlr_layer_shell_v1.c +++ b/types/wlr_layer_shell_v1.c @@ -315,10 +315,7 @@ static const struct zwlr_layer_surface_v1_interface layer_surface_implementation uint32_t wlr_layer_surface_v1_configure(struct wlr_layer_surface_v1 *surface, uint32_t width, uint32_t height) { - if (!surface->initialized) { - wlr_log(WLR_ERROR, "A configure is sent to an uninitialized wlr_layer_surface_v1 %p", - surface); - } + assert(surface->initialized); struct wl_display *display = wl_client_get_display(wl_resource_get_client(surface->resource)); diff --git a/types/xdg_shell/wlr_xdg_surface.c b/types/xdg_shell/wlr_xdg_surface.c index a752ba316..5652fc26c 100644 --- a/types/xdg_shell/wlr_xdg_surface.c +++ b/types/xdg_shell/wlr_xdg_surface.c @@ -165,10 +165,7 @@ uint32_t wlr_xdg_surface_schedule_configure(struct wlr_xdg_surface *surface) { struct wl_display *display = wl_client_get_display(surface->client->client); struct wl_event_loop *loop = wl_display_get_event_loop(display); - if (!surface->initialized) { - wlr_log(WLR_ERROR, "A configure is scheduled for an uninitialized xdg_surface %p", - surface); - } + assert(surface->initialized); if (surface->configure_idle == NULL) { surface->scheduled_serial = wl_display_next_serial(display);