all repos — mgba @ f5d6d6fbc90ee44bd396b7baea528621af019e3c

mGBA Game Boy Advance Emulator

GBA Context: Fix crash when destroying a GBAContext that has BIOS loaded
Jeffrey Pfau jeffrey@endrift.com
Sat, 09 Jan 2016 02:09:30 -0800
commit

f5d6d6fbc90ee44bd396b7baea528621af019e3c

parent

5f912d231f34595bbf5171ca7291b88e6bdb0c50

1 files changed, 4 insertions(+), 4 deletions(-)

jump to
M src/gba/context/context.csrc/gba/context/context.c

@@ -72,6 +72,10 @@

void GBAContextDeinit(struct GBAContext* context) { ARMDeinit(context->cpu); GBADestroy(context->gba); + if (context->bios) { + context->bios->close(context->bios); + context->bios = 0; + } mappedMemoryFree(context->gba, 0); mappedMemoryFree(context->cpu, 0); GBAConfigDeinit(&context->config);

@@ -103,10 +107,6 @@

void GBAContextUnloadROM(struct GBAContext* context) { GBAUnloadROM(context->gba); GBADirectorySetDetachBase(&context->dirs); - if (context->bios) { - context->bios->close(context->bios); - context->bios = 0; - } if (context->rom) { context->rom->close(context->rom); context->rom = 0;