diff options
author | Jasper St. Pierre <jstpierre@mecheye.net> | 2014-02-18 22:21:33 -0500 |
---|---|---|
committer | Jasper St. Pierre <jstpierre@mecheye.net> | 2014-02-18 22:21:33 -0500 |
commit | 7ef8d21e48438296da066111bdd4c98a5304fb14 (patch) | |
tree | 805e7b41891aa2483401a10423044a4dfc410456 | |
parent | c251eb8ec036df6381ddc81e91e056227ded2b03 (diff) | |
download | mutter-7ef8d21e48438296da066111bdd4c98a5304fb14.tar.gz |
wayland: Allow destroying the wl_surface before the xdg_surface
As resource destruction can happen in any order at shutdown, we
need to be flexible here. A client disconnecting without cleaning
up all its resources should not assert fail.
-rw-r--r-- | src/wayland/meta-wayland-surface.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c index 10767cfff..e8777df95 100644 --- a/src/wayland/meta-wayland-surface.c +++ b/src/wayland/meta-wayland-surface.c @@ -596,11 +596,14 @@ meta_wayland_surface_window_unmanaged (MetaWaylandSurface *surface) static void destroy_window (MetaWaylandSurface *surface) { - MetaDisplay *display = meta_get_display (); - guint32 timestamp = meta_display_get_current_time_roundtrip (display); + if (surface->window) + { + MetaDisplay *display = meta_get_display (); + guint32 timestamp = meta_display_get_current_time_roundtrip (display); + + meta_window_unmanage (surface->window, timestamp); + } - g_assert (surface->window != NULL); - meta_window_unmanage (surface->window, timestamp); g_assert (surface->window == NULL); } @@ -610,11 +613,11 @@ wl_surface_destructor (struct wl_resource *resource) MetaWaylandSurface *surface = wl_resource_get_user_data (resource); MetaWaylandCompositor *compositor = surface->compositor; - /* At the time when the wl_surface is destroyed, we should - * no longer have a window, unless we're an XWayland window - * in which case we received the wl_surface.destroy before - * the UnmapNotify/DestroyNotify. */ - g_assert (surface->window == NULL || surface->window->client_type == META_WINDOW_CLIENT_TYPE_X11); + /* If we still have a window at the time of destruction, that means that + * the client is disconnecting, as the resources are destroyed in a random + * order. Simply destroy the window in this case. */ + if (surface->window) + destroy_window (surface); compositor->surfaces = g_list_remove (compositor->surfaces, surface); |