mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-01 12:46:12 +00:00
c/main: Normalize destroy pattern for comp_renderer.
This commit is contained in:
parent
70982e9c39
commit
7c2ea1369f
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue