]> git.xonotic.org Git - xonotic/darkplaces.git/commit
SVVM: Fix segfault during shutdown, improve previous commit
authorbones_was_here <bones_was_here@xonotic.au>
Wed, 7 Feb 2024 14:19:05 +0000 (00:19 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Wed, 7 Feb 2024 14:37:13 +0000 (00:37 +1000)
commitf126a74a91735cca8765bda2a6e7c68a9ad203fa
treecfd08bffbd1543a78e0616cad11d13c48bb5c579
parent5c4df1aca3001757159902f0d815410a87c6b18a
SVVM: Fix segfault during shutdown, improve previous commit

In 30c47b1aff3ac28359c469a40c44ee700c80e814 a bug in SVVM_reset_cmd was
revealed because that code never ran before that commit:
sometimes the server segfaulted at end of match because SVVM_reset_cmd
called QC code even though SVVM_reset_cmd would only be called by
PRVM_Prog_Reset after it had freed the tempstring memory... so if QC
created a tempstring, crash.

This commit refactors the SV VM shutdown to be consistent with the CL
and MENU shutdown by moving the QC SV_Shutdown() call into a separate
func that (optionally) resets the VM afterwards.  As per
30c47b1aff3ac28359c469a40c44ee700c80e814 we MUST reset when stopping a
server to avoid crashes later, but we can still skip it when changing
map (like in previous versions).

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
sv_main.c
svvm_cmds.c