Commit 7c2ea136 authored by Ryan Pavlik's avatar Ryan Pavlik Committed by Jakob Bornecrantz
Browse files

c/main: Normalize destroy pattern for comp_renderer.

parent 70982e9c
......@@ -552,10 +552,7 @@ compositor_destroy(struct xrt_compositor *xc)
// Make sure we don't have anything to destroy.
comp_compositor_garbage_collect(c);
if (c->r) {
comp_renderer_destroy(c->r);
c->r = NULL;
}
comp_renderer_destroy(&c->r);
comp_resources_close(c, &c->nr);
......
......@@ -120,10 +120,18 @@ comp_renderer_create(struct comp_compositor *c)
}
void
comp_renderer_destroy(struct comp_renderer *r)
comp_renderer_destroy(struct comp_renderer **ptr_r)
{
if (ptr_r == NULL) {
return;
}
struct comp_renderer *r = *ptr_r;
if (r == NULL) {
return;
}
renderer_destroy(r);
free(r);
*ptr_r = NULL;
}
/*
......
......@@ -38,11 +38,13 @@ comp_renderer_create(struct comp_compositor *c);
/*!
* Clean up and free the renderer.
*
* Does null checking and sets to null after freeing.
*
* @public @memberof comp_renderer
* @ingroup comp_main
*/
void
comp_renderer_destroy(struct comp_renderer *r);
comp_renderer_destroy(struct comp_renderer **ptr_r);
/*!
* Render frame.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment