decoder/gme: use AtScopeExit()
This commit is contained in:
parent
256ee7a8c7
commit
6a78d11127
@ -25,6 +25,7 @@
|
|||||||
#include "tag/TagHandler.hxx"
|
#include "tag/TagHandler.hxx"
|
||||||
#include "fs/Path.hxx"
|
#include "fs/Path.hxx"
|
||||||
#include "fs/AllocatedPath.hxx"
|
#include "fs/AllocatedPath.hxx"
|
||||||
|
#include "util/ScopeExit.hxx"
|
||||||
#include "util/FormatString.hxx"
|
#include "util/FormatString.hxx"
|
||||||
#include "util/AllocatedString.hxx"
|
#include "util/AllocatedString.hxx"
|
||||||
#include "util/UriUtil.hxx"
|
#include "util/UriUtil.hxx"
|
||||||
@ -141,6 +142,8 @@ gme_file_decode(Decoder &decoder, Path path_fs)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AtScopeExit(emu) { gme_delete(emu); };
|
||||||
|
|
||||||
FormatDebug(gme_domain, "emulator type '%s'\n",
|
FormatDebug(gme_domain, "emulator type '%s'\n",
|
||||||
gme_type_system(gme_type(emu)));
|
gme_type_system(gme_type(emu)));
|
||||||
|
|
||||||
@ -153,7 +156,6 @@ gme_file_decode(Decoder &decoder, Path path_fs)
|
|||||||
gme_err = gme_track_info(emu, &ti, container.track);
|
gme_err = gme_track_info(emu, &ti, container.track);
|
||||||
if (gme_err != nullptr) {
|
if (gme_err != nullptr) {
|
||||||
LogWarning(gme_domain, gme_err);
|
LogWarning(gme_domain, gme_err);
|
||||||
gme_delete(emu);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,7 +174,6 @@ gme_file_decode(Decoder &decoder, Path path_fs)
|
|||||||
SampleFormat::S16, GME_CHANNELS,
|
SampleFormat::S16, GME_CHANNELS,
|
||||||
error)) {
|
error)) {
|
||||||
LogError(error);
|
LogError(error);
|
||||||
gme_delete(emu);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,8 +210,6 @@ gme_file_decode(Decoder &decoder, Path path_fs)
|
|||||||
if (gme_track_ended(emu))
|
if (gme_track_ended(emu))
|
||||||
break;
|
break;
|
||||||
} while (cmd != DecoderCommand::STOP);
|
} while (cmd != DecoderCommand::STOP);
|
||||||
|
|
||||||
gme_delete(emu);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user