From: Cloudwalk Date: Thu, 22 Jul 2021 16:30:36 +0000 (-0400) Subject: cl_main: Fix double free of meshentities texture pool when running gamedir X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=4d33dcb245a32cf4c44807e8b53e4fccea944633;p=xonotic%2Fdarkplaces.git cl_main: Fix double free of meshentities texture pool when running gamedir Implemented start and shutdown routines for its render module --- diff --git a/cl_main.c b/cl_main.c index e4d56733..343aadba 100644 --- a/cl_main.c +++ b/cl_main.c @@ -2521,6 +2521,28 @@ static void CL_MeshEntities_Restart(void) } } +static void CL_MeshEntities_Start(void) +{ + int i; + entity_t *ent; + for(i = 0; i < NUM_MESHENTITIES; i++) + { + ent = cl_meshentities + i; + Mod_Mesh_Create(ent->render.model, cl_meshentitynames[i]); + } +} + +static void CL_MeshEntities_Shutdown(void) +{ + int i; + entity_t *ent; + for(i = 0; i < NUM_MESHENTITIES; i++) + { + ent = cl_meshentities + i; + Mod_Mesh_Destroy(ent->render.model); + } +} + static void CL_MeshEntities_Init(void) { int i; @@ -2557,7 +2579,7 @@ static void CL_MeshEntities_Init(void) CL_UpdateRenderEntity(&ent->render); } cl_meshentities[MESH_UI].render.flags = RENDER_NOSELFSHADOW; - R_RegisterModule("cl_meshentities", CL_MeshEntities_Restart, CL_MeshEntities_Restart, CL_MeshEntities_Restart, CL_MeshEntities_Restart, CL_MeshEntities_Restart); + R_RegisterModule("cl_meshentities", CL_MeshEntities_Start, CL_MeshEntities_Shutdown, CL_MeshEntities_Restart, CL_MeshEntities_Restart, CL_MeshEntities_Restart); } void CL_MeshEntities_Scene_Clear(void) @@ -2579,10 +2601,6 @@ void CL_MeshEntities_Scene_FinalizeRenderEntity(void) VectorCopy(ent->render.model->normalmaxs, ent->render.maxs); } -static void CL_MeshEntities_Shutdown(void) -{ -} - extern cvar_t r_overheadsprites_pushback; extern cvar_t r_fullbright_directed_pitch_relative; extern cvar_t r_fullbright_directed_pitch;