fix: defer port unregistration to avoid race condition in channel removal
Co-authored-by: aider (deepseek/deepseek-reasoner) <aider@aider.chat>
This commit is contained in:
@@ -19,7 +19,7 @@ void channel_add(jack_client_t *client, int idx)
|
||||
if (!channels[idx].audio_in || !channels[idx].audio_out) {
|
||||
fprintf(stderr, "Failed to register ports for channel %d\n", next_channel_id);
|
||||
/* Do NOT mark channel active – process loop will skip it */
|
||||
channels[idx].active = 0;
|
||||
atomic_store(&channels[idx].active, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -36,8 +36,7 @@ void channel_add(jack_client_t *client, int idx)
|
||||
|
||||
void channel_remove(jack_client_t *client, int idx)
|
||||
{
|
||||
jack_port_unregister(client, channels[idx].audio_in);
|
||||
jack_port_unregister(client, channels[idx].audio_out);
|
||||
(void)client;
|
||||
atomic_store(&channels[idx].active, 0);
|
||||
channel_count--;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user