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

Be exception-safe.
This commit is contained in:
Max Kellermann 2016-09-08 20:41:44 +02:00
parent 5e6c164b9f
commit 957b399e90

View File

@ -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);
AtScopeExit(&decoder) {
/* flush the last chunk */
if (decoder.chunk != nullptr)
decoder.FlushChunk();
};
success = DecoderUnlockedRunUri(decoder, uri, path_fs);
/* flush the last chunk */
if (decoder.chunk != nullptr)
decoder.FlushChunk();
}
if (decoder.error.IsDefined()) {