shell: Make sure we have seat->pointer and seat->touch before dereferencing
Either of these may not be available when we handle wl_shell_surface.move, and we need to not crash when that's the case. https://bugs.freedesktop.org/show_bug.cgi?id=68649
This commit is contained in:
+5
-3
@@ -1226,13 +1226,15 @@ shell_surface_move(struct wl_client *client, struct wl_resource *resource,
|
|||||||
struct shell_surface *shsurf = wl_resource_get_user_data(resource);
|
struct shell_surface *shsurf = wl_resource_get_user_data(resource);
|
||||||
struct weston_surface *surface;
|
struct weston_surface *surface;
|
||||||
|
|
||||||
surface = weston_surface_get_main_surface(seat->pointer->focus);
|
if (seat->pointer &&
|
||||||
if (seat->pointer->button_count > 0 && seat->pointer->grab_serial == serial) {
|
seat->pointer->button_count > 0 &&
|
||||||
|
seat->pointer->grab_serial == serial) {
|
||||||
surface = weston_surface_get_main_surface(seat->pointer->focus);
|
surface = weston_surface_get_main_surface(seat->pointer->focus);
|
||||||
if ((surface == shsurf->surface) &&
|
if ((surface == shsurf->surface) &&
|
||||||
(surface_move(shsurf, seat) < 0))
|
(surface_move(shsurf, seat) < 0))
|
||||||
wl_resource_post_no_memory(resource);
|
wl_resource_post_no_memory(resource);
|
||||||
} else if (seat->touch->grab_serial == serial) {
|
} else if (seat->touch &&
|
||||||
|
seat->touch->grab_serial == serial) {
|
||||||
surface = weston_surface_get_main_surface(seat->touch->focus);
|
surface = weston_surface_get_main_surface(seat->touch->focus);
|
||||||
if ((surface == shsurf->surface) &&
|
if ((surface == shsurf->surface) &&
|
||||||
(surface_touch_move(shsurf, seat) < 0))
|
(surface_touch_move(shsurf, seat) < 0))
|
||||||
|
|||||||
Reference in New Issue
Block a user