From 1e51fecdf5ade44c77de325679f1e010d8ba4273 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristian=20H=C3=B8gsberg?= Date: Sun, 22 Jul 2012 11:33:14 -0400 Subject: [PATCH] compositor: Destroy pending surface callbacks when destroying surface Reported by Dima Ryazanov in <1341937691-26234-1-git-send-email-dima@gmail.com> but we also need to destroy callbacks when the surface is destroyed normally. --- src/compositor.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/compositor.c b/src/compositor.c index 19d5acf..d29df6a 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -657,6 +657,11 @@ weston_surface_unmap(struct weston_surface *surface) weston_compositor_schedule_repaint(surface->compositor); } +struct weston_frame_callback { + struct wl_resource resource; + struct wl_list link; +}; + static void destroy_surface(struct wl_resource *resource) { @@ -666,6 +671,7 @@ destroy_surface(struct wl_resource *resource) container_of(resource, struct weston_surface, surface.resource); struct weston_compositor *compositor = surface->compositor; + struct weston_frame_callback *cb, *next; if (weston_surface_is_mapped(surface)) weston_surface_unmap(surface); @@ -686,6 +692,9 @@ destroy_surface(struct wl_resource *resource) if (!region_is_undefined(&surface->input)) pixman_region32_fini(&surface->input); + wl_list_for_each_safe(cb, next, &surface->frame_callback_list, link) + wl_resource_destroy(&cb->resource); + free(surface); } @@ -1092,11 +1101,6 @@ surface_accumulate_damage(struct weston_surface *surface, pixman_region32_union(opaque, opaque, &surface->transform.opaque); } -struct weston_frame_callback { - struct wl_resource resource; - struct wl_list link; -}; - static void weston_output_repaint(struct weston_output *output, int msecs) { -- 2.7.4