aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--types/wlr_surface.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/types/wlr_surface.c b/types/wlr_surface.c
index 244a2cad..0b2e8c09 100644
--- a/types/wlr_surface.c
+++ b/types/wlr_surface.c
@@ -667,8 +667,14 @@ bool wlr_surface_set_role(struct wlr_surface *surface,
}
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_data = role_data;
return true;