diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2015-03-10 13:42:01 +0100 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2015-03-16 18:02:43 +0100 |
commit | 3ff63165621eef9ca900d7fcde2c25ee194d6a95 (patch) | |
tree | ddb8c8b328e992ee6fc390f4a1edbd6e45238a89 | |
parent | 43058a36984efbe8bc0174451a587eab3a1f7e16 (diff) |
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
-rw-r--r-- | src/wayland/meta-wayland-surface.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c index c62e8ebc..5dfa8fb4 100644 --- a/src/wayland/meta-wayland-surface.c +++ b/src/wayland/meta-wayland-surface.c @@ -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); |