[mutter/wayland] wayland: Allow destroying the wl_surface before the xdg_surface
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wayland] wayland: Allow destroying the wl_surface before the xdg_surface
- Date: Wed, 19 Feb 2014 03:27:02 +0000 (UTC)
commit 7ef8d21e48438296da066111bdd4c98a5304fb14
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Tue Feb 18 22:21:33 2014 -0500
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.
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 10767cf..e8777df 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]