diff --git a/layer.c b/layer.c index 0ea465e..97b2e16 100644 --- a/layer.c +++ b/layer.c @@ -20,6 +20,9 @@ struct liftoff_layer *liftoff_layer_create(struct liftoff_output *output) void liftoff_layer_destroy(struct liftoff_layer *layer) { layer->output->layers_changed = true; + if (layer->plane != NULL) { + layer->plane->layer = NULL; + } if (layer->output->composition_layer == layer) { layer->output->composition_layer = NULL; } diff --git a/plane.c b/plane.c index e23b6c9..8762971 100644 --- a/plane.c +++ b/plane.c @@ -130,6 +130,9 @@ struct liftoff_plane *plane_create(struct liftoff_device *device, uint32_t id) void plane_destroy(struct liftoff_plane *plane) { + if (plane->layer != NULL) { + plane->layer->plane = NULL; + } liftoff_list_remove(&plane->link); free(plane->props); free(plane);