mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-14 06:59:57 -05:00
pipewire: core: static assert member order requirement
The pw_proxy member of pw_core must be the first because the pw_core object is freed via pw_proxy_destroy() -> pw_proxy_unref().
This commit is contained in:
parent
4bec3b56d4
commit
0e823d8a0f
1 changed files with 6 additions and 0 deletions
|
|
@ -476,6 +476,12 @@ struct pw_mempool * pw_core_get_mempool(struct pw_core *core)
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
int pw_core_disconnect(struct pw_core *core)
|
int pw_core_disconnect(struct pw_core *core)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* the `proxy` member must be the first because the whole pw_core object is
|
||||||
|
* freed via the free() call in pw_proxy_destroy() -> pw_proxy_unref()
|
||||||
|
*/
|
||||||
|
SPA_STATIC_ASSERT(offsetof(struct pw_core, proxy) == 0, "`proxy` member must be first");
|
||||||
|
|
||||||
pw_log_debug("%p: disconnect", core);
|
pw_log_debug("%p: disconnect", core);
|
||||||
if (!core->removed)
|
if (!core->removed)
|
||||||
pw_proxy_remove(&core->proxy);
|
pw_proxy_remove(&core->proxy);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue