From 7f3fc6d832cf23424ab275ef8b42bff538a64793 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 3 Oct 2023 14:26:54 +0900 Subject: [PATCH] [nq,qw] Call Mod_ClearAll in CL_Shutdown Although the model subsystem does this too, it does it too late relative to the video shutdown, resulting in segfaults for glsl due to the drivers having been unloaded. --- libs/models/model.c | 1 + nq/source/cl_main.c | 2 ++ qw/source/cl_main.c | 2 ++ 3 files changed, 5 insertions(+) diff --git a/libs/models/model.c b/libs/models/model.c index 3482fb5c1..c993fb154 100644 --- a/libs/models/model.c +++ b/libs/models/model.c @@ -161,6 +161,7 @@ mod_unload_model (size_t ind) //with alias models if (!mod->needload && mod->clear) { mod->clear (mod, mod->data); + mod->clear = 0; } if (mod->type != mod_alias) { mod->needload = true; diff --git a/nq/source/cl_main.c b/nq/source/cl_main.c index 22cce7e0a..f8f21c98b 100644 --- a/nq/source/cl_main.c +++ b/nq/source/cl_main.c @@ -216,6 +216,8 @@ static void CL_Shutdown (void *data) { CL_WriteConfiguration (); + + Mod_ClearAll (); } void diff --git a/qw/source/cl_main.c b/qw/source/cl_main.c index d1212bada..5f6287a82 100644 --- a/qw/source/cl_main.c +++ b/qw/source/cl_main.c @@ -1440,6 +1440,8 @@ CL_Shutdown (void *data) dstring_delete (cls.downloadname); dstring_delete (cls.downloadurl); free (cl.players); + + Mod_ClearAll (); } void