Harden against bad actors
Aborts were happening because of insufficient double lock / double lock
free checks.
@@ -18,7 +18,7 @@ static void grab_mouse(struct wl_client *client, struct wl_resource *resource,
struct wc_server *server = mousegrabber->server;
struct wc_cursor *cursor = server->cursor;
- if (mousegrabber->resource != NULL) {
+ if (mousegrabber->resource != NULL || server->mouse_grab) {
wl_resource_post_error(resource,
ZWAY_COOLER_MOUSEGRABBER_ERROR_ALREADY_GRABBED,
"mouse has already been grabbed");
@@ -37,7 +37,7 @@ static void grab_mouse(struct wl_client *client, struct wl_resource *resource,
static void unset_mouse(struct wc_server *server) {
struct wc_cursor *cursor = server->cursor;
- if (cursor == NULL) {
+ if (cursor == NULL || !server->mouse_grab) {
return;
}
