aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Primak <vyivel@eclair.cafe>2023-07-06 21:46:11 +0300
committerSimon Ser <contact@emersion.fr>2023-07-10 10:03:24 +0200
commit7f2ed1e62c6f53b900fa71581f87259e52ac1cb2 (patch)
tree3ef944d6b819f8dfc765b00a3b67e5796e10b19f
parent7d176b6237b7a043d5b643a21d43b419032750de (diff)
layer-shell: don't remove inert role resource
-rw-r--r--types/wlr_layer_shell_v1.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/types/wlr_layer_shell_v1.c b/types/wlr_layer_shell_v1.c
index 69091f96..82947087 100644
--- a/types/wlr_layer_shell_v1.c
+++ b/types/wlr_layer_shell_v1.c
@@ -22,6 +22,13 @@ static void resource_handle_destroy(struct wl_client *client,
static const struct zwlr_layer_shell_v1_interface layer_shell_implementation;
static const struct zwlr_layer_surface_v1_interface layer_surface_implementation;
+static void layer_surface_destroy(struct wlr_layer_surface_v1 *surface) {
+ wl_signal_emit_mutable(&surface->events.destroy, surface);
+ wl_resource_set_user_data(surface->resource, NULL);
+ free(surface->namespace);
+ free(surface);
+}
+
static struct wlr_layer_shell_v1 *layer_shell_from_resource(
struct wl_resource *resource) {
assert(wl_resource_instance_of(resource, &zwlr_layer_shell_v1_interface,
@@ -286,13 +293,15 @@ uint32_t wlr_layer_surface_v1_configure(struct wlr_layer_surface_v1 *surface,
void wlr_layer_surface_v1_destroy(struct wlr_layer_surface_v1 *surface) {
zwlr_layer_surface_v1_send_closed(surface->resource);
- wlr_surface_destroy_role_object(surface->surface);
+ layer_surface_destroy(surface);
}
static void layer_surface_role_commit(struct wlr_surface *wlr_surface) {
struct wlr_layer_surface_v1 *surface =
wlr_layer_surface_v1_try_from_wlr_surface(wlr_surface);
- assert(surface != NULL);
+ if (surface == NULL) {
+ return;
+ }
const uint32_t horiz = ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT |
ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT;
@@ -340,7 +349,9 @@ static void layer_surface_role_commit(struct wlr_surface *wlr_surface) {
static void layer_surface_role_unmap(struct wlr_surface *wlr_surface) {
struct wlr_layer_surface_v1 *surface =
wlr_layer_surface_v1_try_from_wlr_surface(wlr_surface);
- assert(surface != NULL);
+ if (surface == NULL) {
+ return;
+ }
surface->configured = false;
@@ -358,12 +369,11 @@ static void layer_surface_role_unmap(struct wlr_surface *wlr_surface) {
static void layer_surface_role_destroy(struct wlr_surface *wlr_surface) {
struct wlr_layer_surface_v1 *surface =
wlr_layer_surface_v1_try_from_wlr_surface(wlr_surface);
- assert(surface != NULL);
+ if (surface == NULL) {
+ return;
+ }
- wl_signal_emit_mutable(&surface->events.destroy, surface);
- wl_resource_set_user_data(surface->resource, NULL);
- free(surface->namespace);
- free(surface);
+ layer_surface_destroy(surface);
}
static const struct wlr_surface_role layer_surface_role = {