[PATCH weston 05/10] text-backend: handle the text backend client destroy signal
Pekka Paalanen
ppaalanen at gmail.com
Wed Aug 27 07:05:23 PDT 2014
On Mon, 25 Aug 2014 20:56:47 +0200
rawoul at gmail.com wrote:
> From: Arnaud Vrac <avrac at freebox.fr>
>
> Mimic what was implemented for desktop-shell in 312ea4ca, to avoid a
> crash on shutdown.
> ---
> src/text-backend.c | 21 ++++++++++++++++++++-
> 1 file changed, 20 insertions(+), 1 deletion(-)
>
> diff --git a/src/text-backend.c b/src/text-backend.c
> index 7d2a064..dfb5dde 100644
> --- a/src/text-backend.c
> +++ b/src/text-backend.c
> @@ -95,6 +95,7 @@ struct text_backend {
> struct wl_resource *binding;
> struct weston_process process;
> struct wl_client *client;
> + struct wl_listener client_destroy_listener;
>
> unsigned deathcount;
> uint32_t deathstamp;
> @@ -882,6 +883,16 @@ handle_input_method_sigchld(struct weston_process *process, int status)
> }
>
> static void
> +handle_input_method_disconnect(struct wl_listener *listener, void *data)
> +{
> + struct text_backend *text_backend =
> + container_of(listener, struct text_backend,
> + input_method.client_destroy_listener);
> +
> + text_backend->input_method.client = NULL;
> +}
> +
> +static void
> launch_input_method(struct text_backend *text_backend)
> {
> if (text_backend->input_method.binding)
> @@ -898,8 +909,16 @@ launch_input_method(struct text_backend *text_backend)
> text_backend->input_method.path,
> handle_input_method_sigchld);
>
> - if (!text_backend->input_method.client)
> + if (!text_backend->input_method.client) {
> weston_log("not able to start %s\n", text_backend->input_method.path);
> + return;
> + }
> +
> + text_backend->input_method.client_destroy_listener.notify =
> + handle_input_method_disconnect;
> +
> + wl_client_add_destroy_listener(text_backend->input_method.client,
> + &text_backend->input_method.client_destroy_listener);
> }
>
> static void
Hi,
I'd rather not do this now, but replicate the solution (if it passes
review) done for desktop-shell in the series:
http://lists.freedesktop.org/archives/wayland-devel/2014-August/016901.html
I think if disconnect comes after sigchld, you might be resetting to
NULL the pointer that was set already to the new client, no?
Thanks,
pq
More information about the wayland-devel
mailing list