[PATCH] shell: don't segfault when pressing super+k when no surface is focused

Kristian Høgsberg hoegsberg at gmail.com
Mon Aug 13 13:29:37 PDT 2012


On Mon, Aug 13, 2012 at 09:27:27PM +0200, Philipp Brüschweiler wrote:

Oops, yes, that looks better.

Kristian

> ---
>  src/shell.c | 7 ++++++-
>  1 Datei geändert, 6 Zeilen hinzugefügt(+), 1 Zeile entfernt(-)
> 
> diff --git a/src/shell.c b/src/shell.c
> index 51480ce..4d6bc4f 100644
> --- a/src/shell.c
> +++ b/src/shell.c
> @@ -3271,12 +3271,17 @@ static void
>  force_kill_binding(struct wl_seat *seat, uint32_t time, uint32_t key,
>  		   void *data)
>  {
> +	struct wl_surface *focus_surface;
>  	struct wl_client *client;
>  	pid_t pid;
>  	uid_t uid;
>  	gid_t gid;
>  
> -	client = seat->keyboard->focus->resource.client;
> +	focus_surface = seat->keyboard->focus;
> +	if (!focus_surface)
> +		return;
> +
> +	client = focus_surface->resource.client;
>  	wl_client_get_credentials(client, &pid, &uid, &gid);
>  
>  	kill(pid, SIGKILL);
> -- 
> 1.7.11.4
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list