Commit ec3f779a authored by myfreeweb's avatar myfreeweb Committed by Daniel Stone

desktop-shell: fix resize grab related crash

This crash was happening when *releasing* a pointer button on a window
that was being resized and got destroyed during the grab.

[@daniels: Cosmetic fixes; apply same fix to grab cancel.]
parent dce10bd1
......@@ -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);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment