Commit 957b399e authored by Max Kellermann's avatar Max Kellermann

decoder/Thread: call FlushChunk() using AtScopeExit()

Be exception-safe.
parent 5e6c164b
......@@ -36,6 +36,7 @@
#include "util/Error.hxx"
#include "util/RuntimeError.hxx"
#include "util/Domain.hxx"
#include "util/ScopeExit.hxx"
#include "thread/Name.hxx"
#include "tag/ApeReplayGain.hxx"
#include "Log.hxx"
......@@ -404,12 +405,14 @@ decoder_run_song(DecoderControl &dc,
{
const ScopeUnlock unlock(dc.mutex);
success = DecoderUnlockedRunUri(decoder, uri, path_fs);
AtScopeExit(&decoder) {
/* flush the last chunk */
if (decoder.chunk != nullptr)
decoder.FlushChunk();
};
/* flush the last chunk */
success = DecoderUnlockedRunUri(decoder, uri, path_fs);
if (decoder.chunk != nullptr)
decoder.FlushChunk();
}
if (decoder.error.IsDefined()) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment