summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg V <greg@unrelenting.technology>2018-11-08 00:24:56 +0300
committerDaniel Stone <daniels@collabora.com>2019-02-16 09:45:36 +0000
commitec3f779aa76332b4087e1bc882e83e11a073e478 (patch)
tree80bea3e8b151fa4c6d5d9f4085e7254c36764f40
parentdce10bd1416adecca8cca8bab1d1b8e5fc09f791 (diff)
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.]
-rw-r--r--desktop-shell/shell.c19
1 files changed, 13 insertions, 6 deletions
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);
}