]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
calling VM_SetTraceGlobals can create a tempstring for the texture name; thus,
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 15 May 2007 23:12:54 +0000 (23:12 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 15 May 2007 23:12:54 +0000 (23:12 +0000)
make sure that the tempstring gets freed when VM_SetTraceGlobals gets called
from outside QC (before calling the touch function)

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7286 d7cf8633-e32d-0410-b094-e92efae38249

sv_phys.c

index 8de8f7eaeac7fe72555dbb088d4d37a7fff4c4fd..357327d37e4eb8bb59b5974c5176aa8d726a94d9 100644 (file)
--- a/sv_phys.c
+++ b/sv_phys.c
@@ -610,14 +610,17 @@ Two entities have touched, so run their touch functions
 ==================
 */
 extern void VM_SetTraceGlobals(const trace_t *trace);
+extern sizebuf_t vm_tempstringsbuf;
 void SV_Impact (prvm_edict_t *e1, trace_t *trace)
 {
+       int restorevm_tempstringsbuf_cursize;
        int old_self, old_other;
        prvm_edict_t *e2 = (prvm_edict_t *)trace->ent;
        prvm_eval_t *val;
 
        old_self = prog->globals.server->self;
        old_other = prog->globals.server->other;
+       restorevm_tempstringsbuf_cursize = vm_tempstringsbuf.cursize;
 
        VM_SetTraceGlobals(trace);
 
@@ -650,6 +653,7 @@ void SV_Impact (prvm_edict_t *e1, trace_t *trace)
 
        prog->globals.server->self = old_self;
        prog->globals.server->other = old_other;
+       vm_tempstringsbuf.cursize = restorevm_tempstringsbuf_cursize;
 }