]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_main.c
cl_main: Destroy mesh entities on restart to fix memlist getting cluttered
[xonotic/darkplaces.git] / cl_main.c
index e468e92a861074404f7d56786d76dc51019958a1..6d46bc77046e9c2ed0d74ac8999ce62468ed823e 100644 (file)
--- a/cl_main.c
+++ b/cl_main.c
@@ -432,6 +432,9 @@ void CL_Disconnect(void)
 
        // If we're dropped mid-connection attempt, it won't clear otherwise.
        SCR_ClearLoadingScreen(false);
+
+       if(host.hook.SV_Shutdown)
+               host.hook.SV_Shutdown();
 }
 
 /*
@@ -512,9 +515,7 @@ static void CL_Connect_f(cmd_state_t *cmd)
 
 void CL_Disconnect_f(cmd_state_t *cmd)
 {
-       CL_Disconnect ();
-       if (sv.active)
-               SV_Shutdown ();
+       CL_Disconnect();
 }
 
 
@@ -2492,6 +2493,7 @@ static void CL_MeshEntities_Restart(void)
        for (i = 0; i < NUM_MESHENTITIES; i++)
        {
                ent = cl_meshentities + i;
+               Mod_Mesh_Destroy(ent->render.model);
                Mod_Mesh_Create(ent->render.model, cl_meshentitynames[i]);
        }
 }