output/Control: implicitly call BeginDestroy() in destructor

This commit is contained in:
Max Kellermann 2019-04-26 14:28:30 +02:00
parent 92022658f9
commit b42f19f514
2 changed files with 4 additions and 2 deletions

View File

@ -42,6 +42,8 @@ AudioOutputControl::AudioOutputControl(std::unique_ptr<FilteredAudioOutput> _out
AudioOutputControl::~AudioOutputControl() noexcept
{
BeginDestroy();
if (thread.IsDefined())
thread.Join();
}
@ -378,6 +380,7 @@ AudioOutputControl::BeginDestroy() noexcept
{
if (thread.IsDefined()) {
const std::lock_guard<Mutex> protect(mutex);
CommandAsync(Command::KILL);
if (IsCommandFinished())
CommandAsync(Command::KILL);
}
}

View File

@ -84,7 +84,6 @@ LoadOutputControl(EventLoop &event_loop,
try {
control->Configure(block);
} catch (...) {
control->BeginDestroy();
delete control;
throw;
}