[PATCH weston] xwm: set surface_id of a window to 0 if paired immediately

Boyan Ding stu_dby at 126.com
Wed Jul 9 00:17:30 PDT 2014


The surface_id of a wm_window is set to non-zero when shell surface
of the window exists but not mapped, and that wm_window will be inserted
into an unpaired_window_list. If window is mapped immediately in
weston_wm_handle_surface_id, it will not go into the list. However, we
forgot to set surface_id back to zero in this case, causing crash when
trying to remove the window from unpaired list which it is not in.

This bug affects version 1.5 and master with the new Xwayland DDX.

Signed-off-by: Boyan Ding <stu_dby at 126.com>
---
 xwayland/window-manager.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/xwayland/window-manager.c b/xwayland/window-manager.c
index 2fb65b1..3444141 100644
--- a/xwayland/window-manager.c
+++ b/xwayland/window-manager.c
@@ -1377,10 +1377,11 @@ weston_wm_window_handle_surface_id(struct weston_wm_window *window,
 	window->surface_id = client_message->data.data32[0];
 	resource = wl_client_get_object(wm->server->client,
 					window->surface_id);
-	if (resource)
+	if (resource) {
 		xserver_map_shell_surface(window,
 					  wl_resource_get_user_data(resource));
-	else
+		window->surface_id = 0;
+	} else
 		wl_list_insert(&wm->unpaired_window_list, &window->link);
 }
 
-- 
2.0.1




More information about the wayland-devel mailing list