diff options
author | Tanu Kaskinen <tanuk@iki.fi> | 2016-10-12 17:20:41 +0300 |
---|---|---|
committer | Tanu Kaskinen <tanuk@iki.fi> | 2016-12-20 01:30:59 +0200 |
commit | 74ff1153425c927e6dfd198cbf1e0d6edfbfa873 (patch) | |
tree | 022b48bc3ef265d688ab8ff6ce1e5b203b4fd140 /src/pulsecore | |
parent | c3393d27a5b18bca3e052d54a734d5cfb9e0aea0 (diff) |
sink-input, source-output: set sink/source to NULL before the "unlink post" hook
At the time the "unlink post" hook is fired, the stream is not any more
connected to its old device, so it makes sense to reset the sink/source
pointer to NULL before firing the hook. If this is not done, the pointer
may become stale during the "unlink post" hook, because
module-bluetooth-policy does a card profile change in its "unlink post"
callback, so even if the pointer is valid when module-bluetooth-policy's
callback is called, it will be invalid in subsequent callbacks.
Diffstat (limited to 'src/pulsecore')
-rw-r--r-- | src/pulsecore/sink-input.c | 10 | ||||
-rw-r--r-- | src/pulsecore/source-output.c | 10 |
2 files changed, 10 insertions, 10 deletions
diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c index 0dda204c..c248cd87 100644 --- a/src/pulsecore/sink-input.c +++ b/src/pulsecore/sink-input.c @@ -697,11 +697,6 @@ void pa_sink_input_unlink(pa_sink_input *i) { reset_callbacks(i); - if (linked) { - pa_subscription_post(i->core, PA_SUBSCRIPTION_EVENT_SINK_INPUT|PA_SUBSCRIPTION_EVENT_REMOVE, i->index); - pa_hook_fire(&i->core->hooks[PA_CORE_HOOK_SINK_INPUT_UNLINK_POST], i); - } - if (i->sink) { if (PA_SINK_IS_LINKED(pa_sink_get_state(i->sink))) pa_sink_update_status(i->sink); @@ -709,6 +704,11 @@ void pa_sink_input_unlink(pa_sink_input *i) { i->sink = NULL; } + if (linked) { + pa_subscription_post(i->core, PA_SUBSCRIPTION_EVENT_SINK_INPUT|PA_SUBSCRIPTION_EVENT_REMOVE, i->index); + pa_hook_fire(&i->core->hooks[PA_CORE_HOOK_SINK_INPUT_UNLINK_POST], i); + } + pa_core_maybe_vacuum(i->core); pa_sink_input_unref(i); diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c index 35ef1c54..3c421ad1 100644 --- a/src/pulsecore/source-output.c +++ b/src/pulsecore/source-output.c @@ -591,11 +591,6 @@ void pa_source_output_unlink(pa_source_output*o) { reset_callbacks(o); - if (linked) { - pa_subscription_post(o->core, PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT|PA_SUBSCRIPTION_EVENT_REMOVE, o->index); - pa_hook_fire(&o->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_UNLINK_POST], o); - } - if (o->source) { if (PA_SOURCE_IS_LINKED(pa_source_get_state(o->source))) pa_source_update_status(o->source); @@ -603,6 +598,11 @@ void pa_source_output_unlink(pa_source_output*o) { o->source = NULL; } + if (linked) { + pa_subscription_post(o->core, PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT|PA_SUBSCRIPTION_EVENT_REMOVE, o->index); + pa_hook_fire(&o->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_UNLINK_POST], o); + } + pa_core_maybe_vacuum(o->core); pa_source_output_unref(o); |