mirror of
https://github.com/brl/mutter.git
synced 2024-11-12 17:27:03 -05:00
wayland: Protect against unordered destruction of surface resources
If the wl_surface resource happens to be destroyed before any other role resource, the destructor for the latter will attempt to access/modify random memory. Fix this by ensuring the associated resources are destroyed on the wl_surface destructor, this will free all associated memory and remove the resources ahead of their imminent destruction. https://bugzilla.gnome.org/show_bug.cgi?id=745734
This commit is contained in:
parent
43058a3698
commit
3ff6316562
@ -684,6 +684,18 @@ wl_surface_destructor (struct wl_resource *resource)
|
||||
|
||||
if (surface->resource)
|
||||
wl_resource_set_user_data (surface->resource, NULL);
|
||||
|
||||
if (surface->xdg_surface)
|
||||
wl_resource_destroy (surface->xdg_surface);
|
||||
if (surface->xdg_popup)
|
||||
wl_resource_destroy (surface->xdg_popup);
|
||||
if (surface->wl_subsurface)
|
||||
wl_resource_destroy (surface->wl_subsurface);
|
||||
if (surface->wl_shell_surface)
|
||||
wl_resource_destroy (surface->wl_shell_surface);
|
||||
if (surface->gtk_surface)
|
||||
wl_resource_destroy (surface->gtk_surface);
|
||||
|
||||
g_slice_free (MetaWaylandSurface, surface);
|
||||
|
||||
meta_wayland_compositor_repick (compositor);
|
||||
|
Loading…
Reference in New Issue
Block a user