jack: actually clear the mix io

When we are asked to clear the mix io areas, actually do it, otherwise
the process thread might still be accessing the old memory and crash.

Also check that we have set io on the port before we decrement the
counter with active io or else we have a negative value and cause
problems later. This can happen when we susupend and set io to NULL but
there was never any io set on the port.

Fixes #4337
This commit is contained in:
Wim Taymans 2024-10-06 12:36:18 +02:00
parent 0db2171cd9
commit 27961630a6

View file

@ -612,7 +612,9 @@ do_mix_set_io(struct spa_loop *loop, bool async, uint32_t seq,
port->global_mix->io[1] = &port->io[1];
}
} else {
if (--port->n_mix == 0 && port->global_mix != NULL) {
info->mix->io[0] = NULL;
info->mix->io[1] = NULL;
if (port->n_mix > 0 && --port->n_mix == 0 && port->global_mix != NULL) {
port->global_mix->io[0] = NULL;
port->global_mix->io[1] = NULL;
}