[PATCH weston 2/2] compositor: set weston_surface:resource to NULL when destroyed
Bryce W. Harrington
b.harrington at samsung.com
Mon Nov 18 20:52:29 PST 2013
On Fri, Nov 15, 2013 at 10:06:15PM +0100, Giulio Camuffo wrote:
> with the previous patch the resource isn't used inside weston_surface_destroy()
> anymore (aside sending events unuseful for a closing client), so we can safely
> reset it.
>
> Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
> ---
> src/compositor.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/src/compositor.c b/src/compositor.c
> index c6cf682..1cf63c8 100644
> --- a/src/compositor.c
> +++ b/src/compositor.c
> @@ -1339,6 +1339,10 @@ destroy_surface(struct wl_resource *resource)
> {
> struct weston_surface *surface = wl_resource_get_user_data(resource);
>
> + /* Set the resource to NULL, since we don't want to leave a
> + * dangling pointer if the surface was refcounted and survives
> + * the weston_surface_destroy() call. */
> + surface->resource = NULL;
> weston_surface_destroy(surface);
> }
For both patches in the series:
Reviewed-by: Bryce Harrington <b.harrington at samsung.com>
More information about the wayland-devel
mailing list