mirror of https://github.com/mgba-emu/mgba.git
GBA: Fix filehandle leak with savegames
This commit is contained in:
parent
28c896eb9f
commit
d708a1025d
1
CHANGES
1
CHANGES
|
@ -34,6 +34,7 @@ Bugfixes:
|
|||
- VFS: Fix uninitialized varaible reading from 7z
|
||||
- GBA: Fix losing IRQs when CPSR I bit isn't cleared
|
||||
- VFS: Fix reading multiple files from a 7z archive
|
||||
- GBA: Fix filehandle leak with savegames
|
||||
Misc:
|
||||
- 3DS: Use blip_add_delta_fast for a small speed improvement
|
||||
- OpenGL: Log shader compilation failure
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "gba/hle-bios.h"
|
||||
#include "util/math.h"
|
||||
#include "util/memory.h"
|
||||
#include "util/vfs.h"
|
||||
|
||||
#define IDLE_LOOP_THRESHOLD 10000
|
||||
|
||||
|
@ -92,6 +93,9 @@ void GBAMemoryDeinit(struct GBA* gba) {
|
|||
mappedMemoryFree(gba->memory.rom, gba->memory.romSize);
|
||||
}
|
||||
GBASavedataDeinit(&gba->memory.savedata);
|
||||
if (gba->memory.savedata.realVf) {
|
||||
gba->memory.savedata.realVf->close(gba->memory.savedata.realVf);
|
||||
}
|
||||
}
|
||||
|
||||
void GBAMemoryReset(struct GBA* gba) {
|
||||
|
|
|
@ -47,6 +47,9 @@ void GBASavedataDeinit(struct GBASavedata* savedata) {
|
|||
if (savedata->vf) {
|
||||
size_t size = GBASavedataSize(savedata);
|
||||
savedata->vf->unmap(savedata->vf, savedata->data, size);
|
||||
if (savedata->vf != savedata->realVf) {
|
||||
savedata->vf->close(savedata->vf);
|
||||
}
|
||||
savedata->vf = 0;
|
||||
} else {
|
||||
switch (savedata->type) {
|
||||
|
|
Loading…
Reference in New Issue