diff --git a/xwayland/window-manager.c b/xwayland/window-manager.c index 625a0e6bc..0e4beb6a7 100644 --- a/xwayland/window-manager.c +++ b/xwayland/window-manager.c @@ -1371,14 +1371,17 @@ weston_wm_window_handle_surface_id(struct weston_wm_window *window, * hasn't been created yet. In that case put the window on * the unpaired window list and continue when the surface gets * created. */ - window->surface_id = client_message->data.data32[0]; - resource = wl_client_get_object(wm->server->client, - window->surface_id); - if (resource) + uint32_t surface = client_message->data.data32[0]; + resource = wl_client_get_object(wm->server->client, surface); + if (resource) { + window->surface_id = 0; xserver_map_shell_surface(window, wl_resource_get_user_data(resource)); - else + } + else { + window->surface_id = surface; wl_list_insert(&wm->unpaired_window_list, &window->link); + } } static void