From b42f19f514950bcf5b1fd1617b4ebb9b50f395d3 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 26 Apr 2019 14:28:30 +0200 Subject: [PATCH] output/Control: implicitly call BeginDestroy() in destructor --- src/output/Control.cxx | 5 ++++- src/output/MultipleOutputs.cxx | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) 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; }