mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
media-session: guard against node destroy while iterating
When we are iterating the nodes and one is destroyed, restart the scan operation so that we avoid accessing invalid memory. See #901
This commit is contained in:
parent
f021866adb
commit
a96d8aa1aa
1 changed files with 7 additions and 1 deletions
|
|
@ -78,6 +78,7 @@ struct impl {
|
||||||
uint32_t sample_rate;
|
uint32_t sample_rate;
|
||||||
|
|
||||||
struct spa_list node_list;
|
struct spa_list node_list;
|
||||||
|
unsigned int node_list_changed:1;
|
||||||
int seq;
|
int seq;
|
||||||
|
|
||||||
struct default_node defaults[4];
|
struct default_node defaults[4];
|
||||||
|
|
@ -893,8 +894,13 @@ static void session_rescan(void *data, int seq)
|
||||||
|
|
||||||
pw_log_debug(NAME" %p: rescan", impl);
|
pw_log_debug(NAME" %p: rescan", impl);
|
||||||
|
|
||||||
spa_list_for_each(node, &impl->node_list, link)
|
again:
|
||||||
|
impl->node_list_changed = false;
|
||||||
|
spa_list_for_each(node, &impl->node_list, link) {
|
||||||
rescan_node(impl, node);
|
rescan_node(impl, node);
|
||||||
|
if (impl->node_list_changed)
|
||||||
|
goto again;
|
||||||
|
}
|
||||||
|
|
||||||
refresh_auto_default_nodes(impl);
|
refresh_auto_default_nodes(impl);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue