mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
pulse-server: pending-sample: move reference counting
Move the reference counting from `pending_sample_free()` into `on_sample_done()` so that the client's references are managed in a single place. The reason why `pending_sample_free()` cannot simply call `client_unref()` is that `client_free()` may be called from `manager_disconnect()` regardless of the reference count, and, in turn, `pending_sample_free()` may be called, which could then lead to a recursive call to `client_free()`.
This commit is contained in:
parent
29a288ebae
commit
bc2914b3e9
2 changed files with 2 additions and 4 deletions
|
|
@ -41,7 +41,5 @@ void pending_sample_free(struct pending_sample *ps)
|
||||||
spa_hook_remove(&ps->listener);
|
spa_hook_remove(&ps->listener);
|
||||||
pw_work_queue_cancel(impl->work_queue, ps, SPA_ID_INVALID);
|
pw_work_queue_cancel(impl->work_queue, ps, SPA_ID_INVALID);
|
||||||
|
|
||||||
client->ref--;
|
|
||||||
|
|
||||||
sample_play_destroy(ps->play);
|
sample_play_destroy(ps->play);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2344,9 +2344,9 @@ static void on_sample_done(void *obj, void *data, int res, uint32_t id)
|
||||||
{
|
{
|
||||||
struct pending_sample *ps = obj;
|
struct pending_sample *ps = obj;
|
||||||
struct client *client = ps->client;
|
struct client *client = ps->client;
|
||||||
|
|
||||||
pending_sample_free(ps);
|
pending_sample_free(ps);
|
||||||
if (client->ref <= 0)
|
client_unref(client);
|
||||||
client_free(client);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sample_play_done(void *data, int res)
|
static void sample_play_done(void *data, int res)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue