MetaWaylandSurface: Don't assume a toplevel always have a MetaWindow

When committing a toplevel surface we might no longer have a MetaWindow
associated with it. The reason may vary but some are: a popup was
dismissed, the client attached and committed a NULL buffer to a
wl_surface with the wl_shell_surface role, the client committed a
buffer to a wl_surface which previously had an toplevel window role
which extension object was destroyed.

https://bugzilla.gnome.org/show_bug.cgi?id=755490
This commit is contained in:
Jonas Ådahl 2015-09-24 08:24:54 +08:00
parent 6f64d6b0aa
commit 8b0b0cf028

View File

@ -351,12 +351,6 @@ toplevel_surface_commit (MetaWaylandSurfaceRole *surface_role,
return;
}
}
else if (META_IS_WAYLAND_SURFACE_ROLE_XDG_POPUP (surface->role))
{
/* Ignore commits if we couldn't grab the pointer */
if (!window)
return;
}
else
{
if (surface->buffer == NULL)
@ -369,10 +363,11 @@ toplevel_surface_commit (MetaWaylandSurfaceRole *surface_role,
}
}
g_assert (window != NULL);
/* We resize X based surfaces according to X events */
if (window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND)
/* Update the state of the MetaWindow if we still have one. We might not if
* the window was unmanaged (for example popup destroyed, NULL buffer attached to
* wl_shell_surface wl_surface, xdg_surface object was destroyed, etc).
*/
if (window && window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND)
{
MetaRectangle geom = { 0 };