summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiulio Camuffo <giuliocamuffo@gmail.com>2014-09-06 16:18:02 +0300
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>2014-09-09 14:00:20 +0300
commit00535ce6b4bee3daac378e3baa83966dcbd96b0b (patch)
tree42e5ae3586844e7ac8f3ff21002a16b3b15b7aff
parent03faed2074794236d94e68aaf7c9d7c2ad5beafd (diff)
downloadweston-00535ce6b4bee3daac378e3baa83966dcbd96b0b.tar.gz
compositor: fix memory corruption when removing an output
The destructor set on the wl_output resources needs the weston_output to be allocated, because it removes the resource from its list. So unset the destructor on all the resources when destroying an output. Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-rw-r--r--src/compositor.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/compositor.c b/src/compositor.c
index c9871cb5..18975bf4 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -3248,6 +3248,8 @@ weston_compositor_remove_output(struct weston_compositor *compositor,
WL_EXPORT void
weston_output_destroy(struct weston_output *output)
{
+ struct wl_resource *resource;
+
output->destroying = 1;
weston_compositor_remove_output(output->compositor, output);
@@ -3261,6 +3263,10 @@ weston_output_destroy(struct weston_output *output)
pixman_region32_fini(&output->previous_damage);
output->compositor->output_id_pool &= ~(1 << output->id);
+ wl_resource_for_each(resource, &output->resource_list) {
+ wl_resource_set_destructor(resource, NULL);
+ }
+
wl_global_destroy(output->global);
}