[PATCH] shell: run surface bindings only when focus surface is not NULL

Kristian Høgsberg hoegsberg at gmail.com
Wed Jan 8 22:19:46 PST 2014


On Sun, Jan 05, 2014 at 08:04:59PM +0100, Rafal Mielniczuk wrote:
> This fixes the crash when move, rotate or resize binding is activated
> while exposay effect is active.
> 
> Steps to reproduce:
> - activate exposay
> - try to rotate the surface with mod + right mouse button
> - crash

Thank you, that should fix
https://bugs.freedesktop.org/show_bug.cgi?id=72885 as well.

Kristian

> ---
>  desktop-shell/shell.c | 21 ++++++++++++++++++---
>  1 file changed, 18 insertions(+), 3 deletions(-)
> 
> diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
> index f85a269..980c802 100644
> --- a/desktop-shell/shell.c
> +++ b/desktop-shell/shell.c
> @@ -3740,10 +3740,15 @@ get_shell_surface_type(struct weston_surface *surface)
>  static void
>  move_binding(struct weston_seat *seat, uint32_t time, uint32_t button, void *data)
>  {
> -	struct weston_surface *focus = seat->pointer->focus->surface;
> +	struct weston_surface *focus;
>  	struct weston_surface *surface;
>  	struct shell_surface *shsurf;
>  
> +	if (seat->pointer->focus == NULL)
> +		return;
> +
> +	focus = seat->pointer->focus->surface;
> +
>  	surface = weston_surface_get_main_surface(focus);
>  	if (surface == NULL)
>  		return;
> @@ -3826,12 +3831,17 @@ touch_move_binding(struct weston_seat *seat, uint32_t time, void *data)
>  static void
>  resize_binding(struct weston_seat *seat, uint32_t time, uint32_t button, void *data)
>  {
> -	struct weston_surface *focus = seat->pointer->focus->surface;
> +	struct weston_surface *focus;
>  	struct weston_surface *surface;
>  	uint32_t edges = 0;
>  	int32_t x, y;
>  	struct shell_surface *shsurf;
>  
> +	if (seat->pointer->focus == NULL)
> +		return;
> +
> +	focus = seat->pointer->focus->surface;
> +
>  	surface = weston_surface_get_main_surface(focus);
>  	if (surface == NULL)
>  		return;
> @@ -4100,10 +4110,15 @@ static void
>  rotate_binding(struct weston_seat *seat, uint32_t time, uint32_t button,
>  	       void *data)
>  {
> -	struct weston_surface *focus = seat->pointer->focus->surface;
> +	struct weston_surface *focus;
>  	struct weston_surface *base_surface;
>  	struct shell_surface *surface;
>  
> +	if (seat->pointer->focus == NULL)
> +		return;
> +
> +	focus = seat->pointer->focus->surface;
> +
>  	base_surface = weston_surface_get_main_surface(focus);
>  	if (base_surface == NULL)
>  		return;
> -- 
> 1.8.5.2
> 
> _______________________________________________
> 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