input/alsa: clear sockets from within IOThread

Fixes assertion failure in implicit destructor.
This commit is contained in:
Max Kellermann 2017-01-13 20:17:16 +01:00
parent c7b0c46d9f
commit 05417049eb
2 changed files with 11 additions and 0 deletions

2
NEWS
View File

@ -1,4 +1,6 @@
ver 0.20.2 (not yet released) ver 0.20.2 (not yet released)
* input
- alsa: fix crash bug
* decoder * decoder
- flac: add options "probesize" and "analyzeduration" - flac: add options "probesize" and "analyzeduration"
* resampler * resampler

View File

@ -28,6 +28,7 @@
#include "AlsaInputPlugin.hxx" #include "AlsaInputPlugin.hxx"
#include "../InputPlugin.hxx" #include "../InputPlugin.hxx"
#include "../AsyncInputStream.hxx" #include "../AsyncInputStream.hxx"
#include "event/Call.hxx"
#include "util/Domain.hxx" #include "util/Domain.hxx"
#include "util/RuntimeError.hxx" #include "util/RuntimeError.hxx"
#include "util/StringCompare.hxx" #include "util/StringCompare.hxx"
@ -99,6 +100,14 @@ public:
} }
~AlsaInputStream() { ~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); snd_pcm_close(capture_handle);
} }