From 05417049eb884c549fa28f8b74fabf097a220af5 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 13 Jan 2017 20:17:16 +0100 Subject: [PATCH] input/alsa: clear sockets from within IOThread Fixes assertion failure in implicit destructor. --- NEWS | 2 ++ src/input/plugins/AlsaInputPlugin.cxx | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/NEWS b/NEWS index 8d4064b11..015ce011c 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,6 @@ ver 0.20.2 (not yet released) +* input + - alsa: fix crash bug * decoder - flac: add options "probesize" and "analyzeduration" * resampler diff --git a/src/input/plugins/AlsaInputPlugin.cxx b/src/input/plugins/AlsaInputPlugin.cxx index b3eceb53a..b0e8ab7d4 100644 --- a/src/input/plugins/AlsaInputPlugin.cxx +++ b/src/input/plugins/AlsaInputPlugin.cxx @@ -28,6 +28,7 @@ #include "AlsaInputPlugin.hxx" #include "../InputPlugin.hxx" #include "../AsyncInputStream.hxx" +#include "event/Call.hxx" #include "util/Domain.hxx" #include "util/RuntimeError.hxx" #include "util/StringCompare.hxx" @@ -99,6 +100,14 @@ public: } ~AlsaInputStream() { + /* ClearSocketList must be called from within the + IOThread; if we don't do it manually here, the + ~MultiSocketMonitor() will do it in the current + thread */ + BlockingCall(MultiSocketMonitor::GetEventLoop(), [this](){ + ClearSocketList(); + }); + snd_pcm_close(capture_handle); }