From 222a6d270ed49d50d0ab73590d45449a77c17ff2 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 26 Jul 2007 13:18:50 +0000 Subject: [PATCH] Increase ref counter of sink input as long as it is included in the sink idxset git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/lennart@1542 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/pulsecore/sink-input.c | 3 ++- src/pulsecore/source-output.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c index db98dd5..9683661 100644 --- a/src/pulsecore/sink-input.c +++ b/src/pulsecore/sink-input.c @@ -198,7 +198,7 @@ pa_sink_input* pa_sink_input_new( i->thread_info.volume = i->volume; i->thread_info.muted = i->muted; - pa_assert_se(pa_idxset_put(core->sink_inputs, i, &i->index) == 0); + pa_assert_se(pa_idxset_put(core->sink_inputs, pa_sink_input_ref(i), &i->index) == 0); pa_assert_se(pa_idxset_put(i->sink->inputs, i, NULL) == 0); pa_log_info("Created input %u \"%s\" on %s with sample spec %s", @@ -235,6 +235,7 @@ void pa_sink_input_disconnect(pa_sink_input *i) { pa_asyncmsgq_send(i->sink->asyncmsgq, PA_MSGOBJECT(i->sink), PA_SINK_MESSAGE_REMOVE_INPUT, i, NULL); pa_idxset_remove_by_data(i->sink->core->sink_inputs, i, NULL); pa_idxset_remove_by_data(i->sink->inputs, i, NULL); + pa_sink_input_unref(i); pa_subscription_post(i->sink->core, PA_SUBSCRIPTION_EVENT_SINK_INPUT|PA_SUBSCRIPTION_EVENT_REMOVE, i->index); diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c index defb779..ee76a6e 100644 --- a/src/pulsecore/source-output.c +++ b/src/pulsecore/source-output.c @@ -157,7 +157,7 @@ pa_source_output* pa_source_output_new( o->thread_info.resampler = resampler; pa_assert_se(pa_idxset_put(core->source_outputs, o, &o->index) == 0); - pa_assert_se( pa_idxset_put(o->source->outputs, o, NULL) == 0); + pa_assert_se(pa_idxset_put(o->source->outputs, pa_source_output_ref(o), NULL) == 0); pa_log_info("Created output %u \"%s\" on %s with sample spec %s", o->index, @@ -191,6 +191,7 @@ void pa_source_output_disconnect(pa_source_output*o) { pa_idxset_remove_by_data(o->source->core->source_outputs, o, NULL); pa_idxset_remove_by_data(o->source->outputs, o, NULL); + pa_source_output_unref(o); pa_subscription_post(o->source->core, PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT|PA_SUBSCRIPTION_EVENT_REMOVE, o->index); -- 2.7.4