[PATCH 2/2] shell: Handle the desktop shell client destroy signal

Jason Ekstrand jason at jlekstrand.net
Fri Dec 20 15:37:54 PST 2013


Looks like a good idea to me.
--Jason
On Dec 20, 2013 1:07 PM, "Ander Conselvan de Oliveira" <conselvan2 at gmail.com>
wrote:

> From: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira at intel.com>
>
> Set the internal pointer for the client to NULL. This fixes a
> segmentation fault at shutdown, where the shell would hang up before
> and cause libwayland to call wl_client_destroy(). When the shell was
> destroyed later, another call to wl_client_destroy() would cause the
> crash.
>
> https://bugs.freedesktop.org/show_bug.cgi?id=72550
> ---
>  desktop-shell/shell.c |   16 ++++++++++++++++
>  desktop-shell/shell.h |    1 +
>  2 files changed, 17 insertions(+)
>
> diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
> index 3d586ec..714881b 100644
> --- a/desktop-shell/shell.c
> +++ b/desktop-shell/shell.c
> @@ -5008,6 +5008,17 @@ desktop_shell_sigchld(struct weston_process
> *process, int status)
>  }
>
>  static void
> +desktop_shell_client_destroy(struct wl_listener *listener, void *data)
> +{
> +       struct desktop_shell *shell;
> +
> +       shell = container_of(listener, struct desktop_shell,
> +                            child.client_destroy_listener);
> +
> +       shell->child.client = NULL;
> +}
> +
> +static void
>  launch_desktop_shell_process(void *data)
>  {
>         struct desktop_shell *shell = data;
> @@ -5019,6 +5030,11 @@ launch_desktop_shell_process(void *data)
>
>         if (!shell->child.client)
>                 weston_log("not able to start %s\n", shell->client);
> +
> +       shell->child.client_destroy_listener.notify =
> +               desktop_shell_client_destroy;
> +       wl_client_add_destroy_listener(shell->child.client,
> +
>  &shell->child.client_destroy_listener);
>  }
>
>  static void
> diff --git a/desktop-shell/shell.h b/desktop-shell/shell.h
> index d7c34fc..7a8194d 100644
> --- a/desktop-shell/shell.h
> +++ b/desktop-shell/shell.h
> @@ -92,6 +92,7 @@ struct desktop_shell {
>                 struct weston_process process;
>                 struct wl_client *client;
>                 struct wl_resource *desktop_shell;
> +               struct wl_listener client_destroy_listener;
>
>                 unsigned deathcount;
>                 uint32_t deathstamp;
> --
> 1.7.9.5
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20131220/46546fb8/attachment.html>


More information about the wayland-devel mailing list