diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index 809f31c8..e0ee506b 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -1654,12 +1654,16 @@ resize_grab_button(struct weston_pointer_grab *grab, struct weston_resize_grab *resize = (struct weston_resize_grab *) grab; struct weston_pointer *pointer = grab->pointer; enum wl_pointer_button_state state = state_w; - struct weston_desktop_surface *desktop_surface = - resize->base.shsurf->desktop_surface; if (pointer->button_count == 0 && state == WL_POINTER_BUTTON_STATE_RELEASED) { - weston_desktop_surface_set_resizing(desktop_surface, false); + if (resize->base.shsurf != NULL) { + struct weston_desktop_surface *desktop_surface = + resize->base.shsurf->desktop_surface; + weston_desktop_surface_set_resizing(desktop_surface, + false); + } + shell_grab_end(&resize->base); free(grab); } @@ -1669,10 +1673,13 @@ static void resize_grab_cancel(struct weston_pointer_grab *grab) { struct weston_resize_grab *resize = (struct weston_resize_grab *) grab; - struct weston_desktop_surface *desktop_surface = - resize->base.shsurf->desktop_surface; - weston_desktop_surface_set_resizing(desktop_surface, false); + if (resize->base.shsurf != NULL) { + struct weston_desktop_surface *desktop_surface = + resize->base.shsurf->desktop_surface; + weston_desktop_surface_set_resizing(desktop_surface, false); + } + shell_grab_end(&resize->base); free(grab); }