input/thread: move code to Stop()

Fixes crash due to "pure virtual method called" in the "mms" input
plugin.  Closes #253
This commit is contained in:
Max Kellermann
2018-03-15 19:23:31 +01:00
parent e8099f01b5
commit 73013a3c04
4 changed files with 30 additions and 3 deletions

View File

@@ -26,8 +26,12 @@
#include <assert.h>
#include <string.h>
ThreadInputStream::~ThreadInputStream()
void
ThreadInputStream::Stop() noexcept
{
if (!thread.IsDefined())
return;
{
const std::lock_guard<Mutex> lock(mutex);
close = true;
@@ -42,6 +46,7 @@ ThreadInputStream::~ThreadInputStream()
buffer->Clear();
HugeFree(buffer->Write().data, buffer_size);
delete buffer;
buffer = nullptr;
}
}