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.]
This commit is contained in:
parent
dce10bd141
commit
ec3f779aa7
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user