compositor: don't call role unmap hook without an object

master
Kirill Primak 1 year ago committed by Simon Ser
parent 0f67580aab
commit fc9b58e84d

@ -87,6 +87,9 @@ struct wlr_surface_role {
void (*commit)(struct wlr_surface *surface); void (*commit)(struct wlr_surface *surface);
/** /**
* Called when the surface is unmapped. May be NULL. * 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); void (*unmap)(struct wlr_surface *surface);
/** /**

@ -752,7 +752,8 @@ void wlr_surface_unmap(struct wlr_surface *surface) {
} }
surface->mapped = false; surface->mapped = false;
wl_signal_emit_mutable(&surface->events.unmap, NULL); 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); surface->role->unmap(surface);
} }

Loading…
Cancel
Save