mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-02 03:45:58 +01:00
wlr_surface: Post error if multiple role objects created
This fixes an assertion failure if a client tries to do this, e.g. by creating multiple toplevel objects for the same surface. If the same role data is set multiple times, this does not cause an error, which is how cursors use this interface.
This commit is contained in:
parent
b614ded3fc
commit
34303e1b47
1 changed files with 7 additions and 1 deletions
|
@ -667,8 +667,14 @@ bool wlr_surface_set_role(struct wlr_surface *surface,
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (surface->role_data != NULL && surface->role_data != role_data) {
|
||||||
|
wl_resource_post_error(error_resource, error_code,
|
||||||
|
"Cannot reassign role %s to wl_surface@%d,"
|
||||||
|
"role object still exists", role->name,
|
||||||
|
wl_resource_get_id(surface->resource));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
assert(surface->role_data == NULL);
|
|
||||||
surface->role = role;
|
surface->role = role;
|
||||||
surface->role_data = role_data;
|
surface->role_data = role_data;
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue