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); }