[PATCH weston v2] compositor-wayland: destroy the appropriate output instead of exiting when receiving an xdg_toplevel::close event

Pekka Paalanen ppaalanen at gmail.com
Fri Oct 13 11:20:06 UTC 2017


On Wed, 27 Sep 2017 16:06:37 +0200
Sergi Granell <xerpi.g.12 at gmail.com> wrote:

> v2: Fix use after free spotted by Daniel Stone
> 
> Signed-off-by: Sergi Granell <xerpi.g.12 at gmail.com>
> ---
>  libweston/compositor-wayland.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/libweston/compositor-wayland.c b/libweston/compositor-wayland.c
> index a99d4a5c..507262e3 100644
> --- a/libweston/compositor-wayland.c
> +++ b/libweston/compositor-wayland.c
> @@ -1098,8 +1098,12 @@ static void
>  handle_xdg_toplevel_close(void *data, struct zxdg_toplevel_v6 *xdg_toplevel)
>  {
>  	struct wayland_output *output = data;
> +	struct weston_compositor *compositor = output->base.compositor;
>  
> -	weston_compositor_exit(output->base.compositor);
> +	wayland_output_destroy(&output->base);
> +
> +	if (wl_list_empty(&compositor->output_list))
> +		weston_compositor_exit(compositor);
>  }
>  
>  static const struct zxdg_toplevel_v6_listener xdg_toplevel_listener = {

Hi,

right, this is exactly what happens on the close button click as well.
Pushed:
   be1090b5..b4e239f2  master -> master

For the future, please mind the summary and the commit message body a
little more. Your summary line should be a lot shorter. For instance in
this case it could be: "compositor-wayland: exit only on last close"
and then explain in the message body why you wrote the patch.


Thanks,
pq
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20171013/d3a7f647/attachment.sig>


More information about the wayland-devel mailing list