commit 0f3b070313b958988ce9062bdc03f600ffedad6e
parent 2c3f9f0f47173fba59b41ba7718a15ee1a0b41f4
Author: Bad Diode <bd@badd10de.dev>
Date: Tue, 17 Oct 2023 20:16:47 +0200
Try to avoid audio callback from working after free
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/uxnemu.c b/src/uxnemu.c
@@ -509,7 +509,7 @@ emu_run(Uxn *u, char *rom)
static int
emu_end(Uxn *u)
{
- free(u->ram);
+ SDL_CloseAudioDevice(audio_id);
#ifdef _WIN32
#pragma GCC diagnostic ignored "-Wint-to-pointer-cast"
TerminateThread((HANDLE)SDL_GetThreadID(stdin_thread), 0);
@@ -517,6 +517,7 @@ emu_end(Uxn *u)
close(0); /* make stdin thread exit */
#endif
SDL_Quit();
+ free(u->ram);
return u->dev[0x0f] & 0x7f;
}