[PATCH weston] gl-renderer: Set renderer to NULL after destroyed

Ucan, Emre (ADITG/SW1) eucan at de.adit-jv.com
Tue Aug 11 06:45:05 PDT 2015


Hi,

> -----Original Message-----
> From: Dawid Gajownik [mailto:gajownik at gmail.com]
> Sent: Dienstag, 11. August 2015 15:31
> To: Ucan, Emre (ADITG/SW1)
> Cc: wayland-devel at lists.freedesktop.org
> Subject: Re: [PATCH weston] gl-renderer: Set renderer to NULL after
> destroyed
> 
> On Tue, Aug 11, 2015 at 4:09 AM, Ucan, Emre (ADITG/SW1) <eucan at de.adit-
> jv.com> wrote:
> > The pointer of the renderer in the compositor data structure is
> > controlled in weston_compositor_shutdown. When it is not NULL, the
> > destroy method of the renderer is called. Therefore, the renderer
> > pointer should be set to NULL in gl_renderer_destroy, so that it would not
> be called when it is already destroyed.
> 
> Hey,
> 
> when it's destroyed twice? In X11 backend in x11_backend_create()?
> Maybe we should not call renderer->destroy(compositor) directly but use
> weston_compositor_shutdown(compositor)?
> 
> diff --git a/src/compositor-x11.c b/src/compositor-x11.c index
> 73ba783..5a7394a 100644
> --- a/src/compositor-x11.c
> +++ b/src/compositor-x11.c
> @@ -1671,7 +1671,7 @@ x11_backend_create(struct weston_compositor
> *compositor,
>  err_x11_input:
>         x11_input_destroy(b);
>  err_renderer:
> -       compositor->renderer->destroy(compositor);
> +       weston_compositor_shutdown(compositor);
>  err_xdisplay:
>         XCloseDisplay(b->dpy);
>  err_free:
> 
> Or did you find another case when renderer is already destroyed?

Yes, in many places:
- fbdev_compositor_create
- drm_compositor_create
- rpi_compositor_create
- wayland_compositor_create

Besides I saw that the pixman renderer is doing it so:

static void
pixman_renderer_destroy(struct weston_compositor *ec)
{
	struct pixman_renderer *pr = get_renderer(ec);

	wl_signal_emit(&pr->destroy_signal, pr);
	weston_binding_destroy(pr->debug_binding);
	free(pr);

	ec->renderer = NULL;
}

It makes sense to change it in one place not in many places.
> 
> Thanks,
>   Dawid

Best regards

Emre Ucan


More information about the wayland-devel mailing list