aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2011-08-31 20:55:49 +0200
committerMax Kellermann <max@duempel.org>2011-08-31 21:01:34 +0200
commit60f7ff3de594ef6b54a61b6ad630819ce026c760 (patch)
tree9872a3df369cd3636a779ee09068d75ec7b90775
parente76c752987e0b943e0ee01d6e062e86befd9e8c5 (diff)
downloadmpd-60f7ff3de594ef6b54a61b6ad630819ce026c760.tar.gz
mpd-60f7ff3de594ef6b54a61b6ad630819ce026c760.tar.xz
mpd-60f7ff3de594ef6b54a61b6ad630819ce026c760.zip
output/pulse: reset callbacks before closing stream/context
Fixes assertion failure when a stream callback is invoked too late after a format change.
-rw-r--r--src/output/pulse_output_plugin.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/output/pulse_output_plugin.c b/src/output/pulse_output_plugin.c
index 8fcf26992..34d736546 100644
--- a/src/output/pulse_output_plugin.c
+++ b/src/output/pulse_output_plugin.c
@@ -233,6 +233,13 @@ pulse_output_delete_stream(struct pulse_output *po)
assert(po != NULL);
assert(po->stream != NULL);
+#if PA_CHECK_VERSION(0,9,8)
+ pa_stream_set_suspended_callback(po->stream, NULL, NULL);
+#endif
+
+ pa_stream_set_state_callback(po->stream, NULL, NULL);
+ pa_stream_set_write_callback(po->stream, NULL, NULL);
+
pa_stream_disconnect(po->stream);
pa_stream_unref(po->stream);
po->stream = NULL;
@@ -247,6 +254,9 @@ pulse_output_delete_context(struct pulse_output *po)
assert(po != NULL);
assert(po->context != NULL);
+ pa_context_set_state_callback(po->context, NULL, NULL);
+ pa_context_set_subscribe_callback(po->context, NULL, NULL);
+
pa_context_disconnect(po->context);
pa_context_unref(po->context);
po->context = NULL;