From 057b234251007daed746aa478d99edbdc9df552e Mon Sep 17 00:00:00 2001 From: Quinn Date: Mon, 15 Sep 2025 15:07:41 +0200 Subject: [PATCH] fix: don't free window twice --- src/io/window.c | 5 +++++ src/main.c | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/io/window.c b/src/io/window.c index 0c34df2..d76d14f 100644 --- a/src/io/window.c +++ b/src/io/window.c @@ -75,6 +75,11 @@ void window_close(void) { } void window_free(void) { + if (!win) { + debug("window has already been freed."); + return; + } + glfwDestroyWindow(win); render_free(); win = NULL; diff --git a/src/main.c b/src/main.c index 386cece..afb7fb7 100644 --- a/src/main.c +++ b/src/main.c @@ -34,8 +34,8 @@ int main(int argc, char **argv) { fatal("failed to initialise!"); window_loop(); - window_free(); - // return success, since some architectures do not follow 0=success + /* return success, since some architectures do not follow 0=success + * This action will call `quit`. */ return EXIT_SUCCESS; }