summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Kiszka2012-05-24 17:05:15 +0200
committermalc2012-05-24 17:35:27 +0200
commitaeb29b6459cb9496b38c820f3faff64cf2369d0d (patch)
tree9812d305c83a30cf9d7173dbbda7b70ec60cac3c
parentes1370: Fix debug code (diff)
downloadqemu-aeb29b6459cb9496b38c820f3faff64cf2369d0d.tar.gz
qemu-aeb29b6459cb9496b38c820f3faff64cf2369d0d.tar.xz
qemu-aeb29b6459cb9496b38c820f3faff64cf2369d0d.zip
audio: Always call fini on exit
Not only clean up enabled voices but any registered one. Backends like pulsaudio rely on unconditional fini handler invocations. This fixes "Memory pool destroyed but not all memory blocks freed!" warnings on VM shutdowns when pa is used and lockups of QEMU on shutdown as it got stuck on some pa-internal synchronization point. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: malc <av1474@comtv.ru>
-rw-r--r--audio/audio.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/audio/audio.c b/audio/audio.c
index bd9237e9d3..583ee51eab 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -1775,10 +1775,12 @@ static void audio_atexit (void)
HWVoiceOut *hwo = NULL;
HWVoiceIn *hwi = NULL;
- while ((hwo = audio_pcm_hw_find_any_enabled_out (hwo))) {
+ while ((hwo = audio_pcm_hw_find_any_out (hwo))) {
SWVoiceCap *sc;
- hwo->pcm_ops->ctl_out (hwo, VOICE_DISABLE);
+ if (hwo->enabled) {
+ hwo->pcm_ops->ctl_out (hwo, VOICE_DISABLE);
+ }
hwo->pcm_ops->fini_out (hwo);
for (sc = hwo->cap_head.lh_first; sc; sc = sc->entries.le_next) {
@@ -1791,8 +1793,10 @@ static void audio_atexit (void)
}
}
- while ((hwi = audio_pcm_hw_find_any_enabled_in (hwi))) {
- hwi->pcm_ops->ctl_in (hwi, VOICE_DISABLE);
+ while ((hwi = audio_pcm_hw_find_any_in (hwi))) {
+ if (hwi->enabled) {
+ hwi->pcm_ops->ctl_in (hwi, VOICE_DISABLE);
+ }
hwi->pcm_ops->fini_in (hwi);
}