From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:43577) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SXZbY-00064z-31 for qemu-devel@nongnu.org; Thu, 24 May 2012 11:05:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SXZbR-0005pr-CI for qemu-devel@nongnu.org; Thu, 24 May 2012 11:05:31 -0400 Received: from david.siemens.de ([192.35.17.14]:25213) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SXZbR-0005oL-2w for qemu-devel@nongnu.org; Thu, 24 May 2012 11:05:25 -0400 Message-ID: <4FBE4E2B.7070902@siemens.com> Date: Thu, 24 May 2012 12:05:15 -0300 From: Jan Kiszka MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH v2] audio: Always call fini on exit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel , malc Cc: Anthony Liguori , Gerd Hoffmann 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 --- Changes in v2: - only disable ports that are enabled audio/audio.c | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-) diff --git a/audio/audio.c b/audio/audio.c index bd9237e..583ee51 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); } -- 1.7.3.4