[pulseaudio-discuss] [PATCH] module-loopback: Reset callbacks in teardown
Tanu Kaskinen
tanuk at iki.fi
Tue Apr 3 22:20:31 PDT 2012
On Tue, 2012-04-03 at 19:03 +0200, David Henningsson wrote:
> Make sure we can't be called into by remaining references to
> sink-inputs and source-outputs after we have teared down, as
> that will likely lead to segfaults or assertion failures.
>
> Signed-off-by: David Henningsson <david.henningsson at canonical.com>
> ---
>
> This is a continuation of the "loopback: Fix crash if max request change at
> unload" thread. Not sure if this makes sense, it probably does, but I have not
> verified how the core will react when all of these are NULL, so won't push without
> additional comments/acks.
>
> Frederic, it would be nice to know if this improves your situation as well.
pa_sink_input_unlink() already resets the callbacks. Did my suggestion
of a one-line fix get any consideration?
http://lists.freedesktop.org/archives/pulseaudio-discuss/2012-March/013091.html
> src/modules/module-loopback.c | 23 +++++++++++++++++++++++
> 1 files changed, 23 insertions(+), 0 deletions(-)
>
> diff --git a/src/modules/module-loopback.c b/src/modules/module-loopback.c
> index 0d65682..e9feb97 100644
> --- a/src/modules/module-loopback.c
> +++ b/src/modules/module-loopback.c
> @@ -152,11 +152,34 @@ static void teardown(struct userdata *u) {
> pa_source_output_unlink(u->source_output);
>
> if (u->sink_input) {
> + u->sink_input->parent.process_msg = NULL;
> + u->sink_input->pop = NULL;
> + u->sink_input->process_rewind = NULL;
> + u->sink_input->kill = NULL;
> + u->sink_input->attach = NULL;
> + u->sink_input->detach = NULL;
> + u->sink_input->update_max_rewind = NULL;
> + u->sink_input->update_max_request = NULL;
> + u->sink_input->may_move_to = NULL;
> + u->sink_input->moving = NULL;
> + u->sink_input->userdata = NULL;
> +
> pa_sink_input_unref(u->sink_input);
> u->sink_input = NULL;
> }
>
> if (u->source_output) {
> + u->source_output->parent.process_msg = NULL;
> + u->source_output->push = NULL;
> + u->source_output->process_rewind = NULL;
> + u->source_output->kill = NULL;
> + u->source_output->attach = NULL;
> + u->source_output->detach = NULL;
> + u->source_output->state_change = NULL;
> + u->source_output->may_move_to = NULL;
> + u->source_output->moving = NULL;
> + u->source_output->userdata = NULL;
> +
> pa_source_output_unref(u->source_output);
> u->source_output = NULL;
> }
More information about the pulseaudio-discuss
mailing list