layer-shell: check whether the surface is mapped in layer_surface_destroy()

If the layer surface has been closed by the compositor, using
layer_surface_close(), then the unmap event is emitted. However, when
the layer surface is later destroyed by the client, the compositor used
to get a second unmap, which is fixed with this commit.
This commit is contained in:
Ilia Bozhinov 2018-06-16 17:29:26 +03:00
parent 8e33deb0be
commit 23707f6504
1 changed files with 3 additions and 1 deletions

View File

@ -176,7 +176,9 @@ static void layer_surface_unmap(struct wlr_layer_surface *surface) {
} }
static void layer_surface_destroy(struct wlr_layer_surface *surface) { static void layer_surface_destroy(struct wlr_layer_surface *surface) {
if (surface->configured && surface->mapped) {
layer_surface_unmap(surface); layer_surface_unmap(surface);
}
wlr_signal_emit_safe(&surface->events.destroy, surface); wlr_signal_emit_safe(&surface->events.destroy, surface);
wl_resource_set_user_data(surface->resource, NULL); wl_resource_set_user_data(surface->resource, NULL);
wl_list_remove(&surface->surface_destroy_listener.link); wl_list_remove(&surface->surface_destroy_listener.link);