summaryrefslogtreecommitdiff
path: root/desktop-shell
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2023-02-16 17:54:22 +0100
committerMarius Vlad <marius.vlad@collabora.com>2023-02-20 12:48:43 +0200
commit06365e602bd7599760a9a1414d12d6c26ca9c445 (patch)
treeb7fb1b7a9df04d69e426942e94d05ae1008f71b7 /desktop-shell
parent6617deebec5586c4d8c61097b7e51dd53c4e4624 (diff)
downloadweston-06365e602bd7599760a9a1414d12d6c26ca9c445.tar.gz
desktop-shell: avoid crashes when a surface disappears during resize
The desktop_surface object is destroyed first so it can happen that the shsurf still exists but desktop_surface is already NULL. So expand the check to make sure the desktop_surface is still available in the resize callbacks. Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'desktop-shell')
-rw-r--r--desktop-shell/shell.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index 967b9712..23d23555 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -1157,7 +1157,7 @@ resize_grab_motion(struct weston_pointer_grab *grab,
weston_pointer_move(pointer, event);
- if (!shsurf)
+ if (!shsurf || !shsurf->desktop_surface)
return;
weston_view_update_transform(shsurf->view);
@@ -1211,7 +1211,7 @@ resize_grab_button(struct weston_pointer_grab *grab,
if (pointer->button_count == 0 &&
state == WL_POINTER_BUTTON_STATE_RELEASED) {
- if (resize->base.shsurf != NULL) {
+ if (resize->base.shsurf && resize->base.shsurf->desktop_surface) {
struct weston_desktop_surface *desktop_surface =
resize->base.shsurf->desktop_surface;
weston_desktop_surface_set_resizing(desktop_surface,
@@ -1229,7 +1229,7 @@ resize_grab_cancel(struct weston_pointer_grab *grab)
{
struct weston_resize_grab *resize = (struct weston_resize_grab *) grab;
- if (resize->base.shsurf != NULL) {
+ if (resize->base.shsurf && resize->base.shsurf->desktop_surface) {
struct weston_desktop_surface *desktop_surface =
resize->base.shsurf->desktop_surface;
weston_desktop_surface_set_resizing(desktop_surface, false);