mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-06 13:30:01 -05:00
v4l2: fix crash when unplugging
Only remove the v4l2 fd once on disconnect Make sure we don't use the clock anymore when a link is destroyed.
This commit is contained in:
parent
16b6a51b78
commit
49afacd66f
2 changed files with 7 additions and 2 deletions
|
|
@ -1194,6 +1194,7 @@ static void v4l2_on_fd_events(struct spa_source *source)
|
|||
if (source->rmask & SPA_IO_ERR) {
|
||||
struct port *port = &this->out_ports[0];
|
||||
spa_log_error(this->log, "v4l2 %p: error %d", this, source->rmask);
|
||||
if (port->source.loop)
|
||||
spa_loop_remove_source(port->data_loop, &port->source);
|
||||
return;
|
||||
}
|
||||
|
|
@ -1470,6 +1471,7 @@ static int do_remove_source(struct spa_loop *loop,
|
|||
void *user_data)
|
||||
{
|
||||
struct port *port = user_data;
|
||||
if (port->source.loop)
|
||||
spa_loop_remove_source(port->data_loop, &port->source);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1288,6 +1288,9 @@ void pw_link_destroy(struct pw_link *link)
|
|||
if (link->registered)
|
||||
spa_list_remove(&link->link);
|
||||
|
||||
if (link->output->node->clock == link->input->node->clock)
|
||||
link->input->node->clock = NULL;
|
||||
|
||||
input_remove(link, link->input);
|
||||
|
||||
output_remove(link, link->output);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue