mirror of https://github.com/mgba-emu/mgba.git
Core: Fix directory sets crashing on close if base isn't properly detached
This commit is contained in:
parent
54548cbc51
commit
66e9b921a9
1
CHANGES
1
CHANGES
|
@ -74,6 +74,7 @@ Bugfixes:
|
|||
- Qt: Fix game unpausing after frame advancing and refocusing
|
||||
- GB Timer: Fix sub-M-cycle DIV reset timing and edge triggering
|
||||
- Core: Fix interrupting a thread while on the thread (fixes mgba.io/i/692)
|
||||
- Core: Fix directory sets crashing on close if base isn't properly detached
|
||||
Misc:
|
||||
- SDL: Remove scancode key input
|
||||
- GBA Video: Clean up unused timers
|
||||
|
|
|
@ -22,28 +22,58 @@ void mDirectorySetDeinit(struct mDirectorySet* dirs) {
|
|||
mDirectorySetDetachBase(dirs);
|
||||
|
||||
if (dirs->archive) {
|
||||
if (dirs->archive == dirs->save) {
|
||||
dirs->save = NULL;
|
||||
}
|
||||
if (dirs->archive == dirs->patch) {
|
||||
dirs->patch = NULL;
|
||||
}
|
||||
if (dirs->archive == dirs->state) {
|
||||
dirs->state = NULL;
|
||||
}
|
||||
if (dirs->archive == dirs->screenshot) {
|
||||
dirs->screenshot = NULL;
|
||||
}
|
||||
dirs->archive->close(dirs->archive);
|
||||
dirs->archive = 0;
|
||||
dirs->archive = NULL;
|
||||
}
|
||||
|
||||
if (dirs->save) {
|
||||
if (dirs->save == dirs->patch) {
|
||||
dirs->patch = NULL;
|
||||
}
|
||||
if (dirs->save == dirs->state) {
|
||||
dirs->state = NULL;
|
||||
}
|
||||
if (dirs->save == dirs->screenshot) {
|
||||
dirs->screenshot = NULL;
|
||||
}
|
||||
dirs->save->close(dirs->save);
|
||||
dirs->save = 0;
|
||||
dirs->save = NULL;
|
||||
}
|
||||
|
||||
if (dirs->patch) {
|
||||
if (dirs->patch == dirs->state) {
|
||||
dirs->state = NULL;
|
||||
}
|
||||
if (dirs->patch == dirs->screenshot) {
|
||||
dirs->screenshot = NULL;
|
||||
}
|
||||
dirs->patch->close(dirs->patch);
|
||||
dirs->patch = 0;
|
||||
dirs->patch = NULL;
|
||||
}
|
||||
|
||||
if (dirs->state) {
|
||||
if (dirs->state == dirs->screenshot) {
|
||||
dirs->state = NULL;
|
||||
}
|
||||
dirs->state->close(dirs->state);
|
||||
dirs->state = 0;
|
||||
dirs->state = NULL;
|
||||
}
|
||||
|
||||
if (dirs->screenshot) {
|
||||
dirs->screenshot->close(dirs->screenshot);
|
||||
dirs->screenshot = 0;
|
||||
dirs->screenshot = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,21 +95,21 @@ void mDirectorySetAttachBase(struct mDirectorySet* dirs, struct VDir* base) {
|
|||
|
||||
void mDirectorySetDetachBase(struct mDirectorySet* dirs) {
|
||||
if (dirs->save == dirs->base) {
|
||||
dirs->save = 0;
|
||||
dirs->save = NULL;
|
||||
}
|
||||
if (dirs->patch == dirs->base) {
|
||||
dirs->patch = 0;
|
||||
dirs->patch = NULL;
|
||||
}
|
||||
if (dirs->state == dirs->base) {
|
||||
dirs->state = 0;
|
||||
dirs->state = NULL;
|
||||
}
|
||||
if (dirs->screenshot == dirs->base) {
|
||||
dirs->screenshot = 0;
|
||||
dirs->screenshot = NULL;
|
||||
}
|
||||
|
||||
if (dirs->base) {
|
||||
dirs->base->close(dirs->base);
|
||||
dirs->base = 0;
|
||||
dirs->base = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue