c/render: Make it safe to call comp_resources_close in more cases

Fixes #139
This commit is contained in:
Jakob Bornecrantz 2021-12-01 15:49:24 +00:00
parent e9c5d34925
commit 27f80a90d9

View file

@ -680,7 +680,10 @@ comp_resources_init(struct comp_resources *r,
void
comp_resources_close(struct comp_resources *r)
{
assert(r->vk != NULL);
// We were never initialised or already closed, always safe to call this function.
if (r->vk == NULL) {
return;
}
struct vk_bundle *vk = r->vk;
@ -710,4 +713,7 @@ comp_resources_close(struct comp_resources *r)
DF(Memory, r->distortion.device_memories[i]);
}
comp_buffer_close(vk, &r->compute.ubo);
// Finally forget about the vk bundle. We do not own it!
r->vk = NULL;
}