mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
[nq] Fix a particularly nasty memory leak
Nasty because it was caused by spaghetti (normally, I like the stuff). Drinking-age spaghetti at that. Nicely, this removes the need for one function in sv_ded.c (which is what I think I was trying to achieve).
This commit is contained in:
parent
a17deb3ef2
commit
1f811e6310
3 changed files with 19 additions and 29 deletions
|
@ -231,9 +231,27 @@ CL_ClearMemory (void)
|
||||||
SCR_SetFullscreen (0);
|
SCR_SetFullscreen (0);
|
||||||
|
|
||||||
cls.signon = 0;
|
cls.signon = 0;
|
||||||
|
SZ_Clear (&cls.message);
|
||||||
|
|
||||||
|
if (cl.viewstate.weapon_entity) {
|
||||||
|
Scene_DestroyEntity (cl_world.scene, cl.viewstate.weapon_entity);
|
||||||
|
}
|
||||||
|
if (cl.players) {
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < cl.maxclients; i++)
|
||||||
|
Info_Destroy (cl.players[i].userinfo);
|
||||||
|
}
|
||||||
|
// wipe the entire cl structure
|
||||||
__auto_type cam = cl.viewstate.camera_transform;
|
__auto_type cam = cl.viewstate.camera_transform;
|
||||||
memset (&cl, 0, sizeof (cl));
|
memset (&cl, 0, sizeof (cl));
|
||||||
cl.viewstate.camera_transform = cam;
|
cl.viewstate.camera_transform = cam;
|
||||||
|
|
||||||
|
CL_ClearTEnts ();
|
||||||
|
|
||||||
|
SCR_NewScene (0);
|
||||||
|
|
||||||
|
CL_ClearEnts ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -267,24 +285,10 @@ CL_InitCvars (void)
|
||||||
void
|
void
|
||||||
CL_ClearState (void)
|
CL_ClearState (void)
|
||||||
{
|
{
|
||||||
|
CL_ClearMemory ();
|
||||||
if (!sv.active)
|
if (!sv.active)
|
||||||
Host_ClearMemory ();
|
Host_ClearMemory ();
|
||||||
|
|
||||||
if (cl.viewstate.weapon_entity) {
|
|
||||||
Scene_DestroyEntity (cl_world.scene, cl.viewstate.weapon_entity);
|
|
||||||
}
|
|
||||||
if (cl.players) {
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < cl.maxclients; i++)
|
|
||||||
Info_Destroy (cl.players[i].userinfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
// wipe the entire cl structure
|
|
||||||
__auto_type cam = cl.viewstate.camera_transform;
|
|
||||||
memset (&cl, 0, sizeof (cl));
|
|
||||||
cl.viewstate.camera_transform = cam;
|
|
||||||
|
|
||||||
cl.viewstate.player_origin = (vec4f_t) {0, 0, 0, 1};
|
cl.viewstate.player_origin = (vec4f_t) {0, 0, 0, 1};
|
||||||
cl.viewstate.chase = 1;
|
cl.viewstate.chase = 1;
|
||||||
cl.viewstate.chasestate = &cl.chasestate;
|
cl.viewstate.chasestate = &cl.chasestate;
|
||||||
|
@ -293,14 +297,6 @@ CL_ClearState (void)
|
||||||
SCR_SetFullscreen (0);
|
SCR_SetFullscreen (0);
|
||||||
r_data->lightstyle = cl.lightstyle;
|
r_data->lightstyle = cl.lightstyle;
|
||||||
|
|
||||||
SZ_Clear (&cls.message);
|
|
||||||
|
|
||||||
CL_ClearTEnts ();
|
|
||||||
|
|
||||||
SCR_NewScene (0);
|
|
||||||
|
|
||||||
CL_ClearEnts ();
|
|
||||||
|
|
||||||
cl.viewstate.weapon_entity = Scene_CreateEntity (cl_world.scene);
|
cl.viewstate.weapon_entity = Scene_CreateEntity (cl_world.scene);
|
||||||
CL_Init_Entity (cl.viewstate.weapon_entity);
|
CL_Init_Entity (cl.viewstate.weapon_entity);
|
||||||
r_data->view_model = cl.viewstate.weapon_entity;
|
r_data->view_model = cl.viewstate.weapon_entity;
|
||||||
|
|
|
@ -627,7 +627,6 @@ void
|
||||||
Host_ClearMemory (void)
|
Host_ClearMemory (void)
|
||||||
{
|
{
|
||||||
Sys_MaskPrintf (SYS_dev, "Clearing memory\n");
|
Sys_MaskPrintf (SYS_dev, "Clearing memory\n");
|
||||||
CL_ClearMemory ();
|
|
||||||
Mod_ClearAll ();
|
Mod_ClearAll ();
|
||||||
if (host_hunklevel)
|
if (host_hunklevel)
|
||||||
Hunk_FreeToLowMark (0, host_hunklevel);
|
Hunk_FreeToLowMark (0, host_hunklevel);
|
||||||
|
|
|
@ -72,11 +72,6 @@ CL_UpdateScreen (double realtime)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
CL_ClearMemory (void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
CL_Cmd_ForwardToServer (void)
|
CL_Cmd_ForwardToServer (void)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue