diff options
author | Kirill Primak <vyivel@eclair.cafe> | 2023-06-22 15:12:30 +0300 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2023-06-23 11:54:05 +0000 |
commit | fc9b58e84da2303148757cad4a83eb17d974edae (patch) | |
tree | 9ad360d15d8cea2cdd086c965b5bf1484a1f286f | |
parent | 0f67580aab115e9667650d52104e3ea3a5dfe20b (diff) |
compositor: don't call role unmap hook without an object
-rw-r--r-- | include/wlr/types/wlr_compositor.h | 3 | ||||
-rw-r--r-- | types/wlr_compositor.c | 3 |
2 files changed, 5 insertions, 1 deletions
diff --git a/include/wlr/types/wlr_compositor.h b/include/wlr/types/wlr_compositor.h index c8b63a59..ba2d4649 100644 --- a/include/wlr/types/wlr_compositor.h +++ b/include/wlr/types/wlr_compositor.h @@ -87,6 +87,9 @@ struct wlr_surface_role { void (*commit)(struct wlr_surface *surface); /** * Called when the surface is unmapped. May be NULL. + * + * If the role is represented by an object, this is only called if + * such object exists. */ void (*unmap)(struct wlr_surface *surface); /** diff --git a/types/wlr_compositor.c b/types/wlr_compositor.c index 21f22666..1a135301 100644 --- a/types/wlr_compositor.c +++ b/types/wlr_compositor.c @@ -752,7 +752,8 @@ void wlr_surface_unmap(struct wlr_surface *surface) { } surface->mapped = false; wl_signal_emit_mutable(&surface->events.unmap, NULL); - if (surface->role != NULL && surface->role->unmap != NULL) { + if (surface->role != NULL && surface->role->unmap != NULL && + (surface->role_data != NULL || surface->role->no_object)) { surface->role->unmap(surface); } |