From f05528524613c1b2ea67fd45d45e84c319a5d6bd Mon Sep 17 00:00:00 2001 From: Minh Phan Date: Sun, 5 Feb 2023 14:38:32 +0700 Subject: [PATCH] xwayland/window: Do not double add window to damage list The window might be retained in the damage list after `xwl_screen_post_damage` in certain conditions. This means we need to check if the window is already in the list to avoid adding the same window twice which will lead to list corruption resulting in server freeze in `xwl_screen_post_damage`. Signed-off-by: Minh Phan (cherry picked from commit ba644a64a415962956de72936d21b6527ee8cd57) --- hw/xwayland/xwayland-window.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/xwayland/xwayland-window.c b/hw/xwayland/xwayland-window.c index 38992d5c1..ba7d7af0b 100644 --- a/hw/xwayland/xwayland-window.c +++ b/hw/xwayland/xwayland-window.c @@ -175,7 +175,8 @@ damage_report(DamagePtr pDamage, RegionPtr pRegion, void *data) } #endif - xorg_list_add(&xwl_window->link_damage, &xwl_screen->damage_window_list); + if (xorg_list_is_empty(&xwl_window->link_damage)) + xorg_list_add(&xwl_window->link_damage, &xwl_screen->damage_window_list); } static void