From 0ad56e0f8e8ba3474d4a95cf9abe283d65b64ebb Mon Sep 17 00:00:00 2001 From: David Guibert Date: Mon, 16 Mar 2009 22:45:13 +0100 Subject: [PATCH] pulse_mixer: close when the mixer is closed, - the mainloop is stopped. - the context is disconnected. - then the mainloop is freed. Signed-off-by: David Guibert --- src/mixer/pulse_mixer.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/mixer/pulse_mixer.c b/src/mixer/pulse_mixer.c index 5e4f294ba..5bb6061fe 100644 --- a/src/mixer/pulse_mixer.c +++ b/src/mixer/pulse_mixer.c @@ -236,7 +236,20 @@ pulse_mixer_open(G_GNUC_UNUSED struct mixer *data) static void pulse_mixer_close(G_GNUC_UNUSED struct mixer *data) { - return; + struct pulse_mixer *pm=(struct pulse_mixer *) data; + if (pm->mainloop) + pa_threaded_mainloop_stop(pm->mainloop); + + if (pm->context) { + pa_context_disconnect(pm->context); + pa_context_unref(pm->context); + pm->context = NULL; + } + + if (pm->mainloop) { + pa_threaded_mainloop_free(pm->mainloop); + pm->mainloop = NULL; + } } static int