diff --git a/src/output/Control.cxx b/src/output/Control.cxx index fdf31de90..ae4fa01b8 100644 --- a/src/output/Control.cxx +++ b/src/output/Control.cxx @@ -42,6 +42,8 @@ AudioOutputControl::AudioOutputControl(std::unique_ptr _out AudioOutputControl::~AudioOutputControl() noexcept { + BeginDestroy(); + if (thread.IsDefined()) thread.Join(); } @@ -378,6 +380,7 @@ AudioOutputControl::BeginDestroy() noexcept { if (thread.IsDefined()) { const std::lock_guard protect(mutex); - CommandAsync(Command::KILL); + if (IsCommandFinished()) + CommandAsync(Command::KILL); } } diff --git a/src/output/MultipleOutputs.cxx b/src/output/MultipleOutputs.cxx index 12c102618..b9d3bb090 100644 --- a/src/output/MultipleOutputs.cxx +++ b/src/output/MultipleOutputs.cxx @@ -84,7 +84,6 @@ LoadOutputControl(EventLoop &event_loop, try { control->Configure(block); } catch (...) { - control->BeginDestroy(); delete control; throw; }