diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c index dc7e83fdb..179b94c8b 100644 --- a/src/wayland/meta-xwayland.c +++ b/src/wayland/meta-xwayland.c @@ -55,13 +55,6 @@ associate_window_with_surface (MetaWindow *window, { MetaDisplay *display = window->display; - /* If the window has an existing surface, like if we're - * undecorating or decorating the window, then we need - * to detach the window from its old surface. - */ - if (window->surface) - window->surface->window = NULL; - if (!meta_wayland_surface_assign_role (surface, META_TYPE_WAYLAND_SURFACE_ROLE_XWAYLAND)) { @@ -88,6 +81,16 @@ associate_window_with_surface_id (MetaXWaylandManager *manager, { struct wl_resource *resource; + /* If the window has an existing surface, like if we're + * undecorating or decorating the window, then we need + * to detach the window from its old surface. + */ + if (window->surface) + { + meta_wayland_surface_set_window (window->surface, NULL); + window->surface = NULL; + } + resource = wl_client_get_object (manager->client, surface_id); if (resource) {