This repository was archived by the owner on Jul 22, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change 1
- // ========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
1
+ // ========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
2
2
//
3
3
// Purpose: Namespace for functions having to do with WC Edit mode
4
4
//
@@ -450,6 +450,19 @@ Vector *g_EntityPositions = NULL;
450
450
QAngle *g_EntityOrientations = NULL ;
451
451
string_t *g_EntityClassnames = NULL ;
452
452
453
+ // Secton: memory leak fix (https://developer.valvesoftware.com/wiki/Memory_Leak_Fixes#WCEdit)
454
+
455
+ class GlobalCleanUp : public CAutoGameSystem
456
+ {
457
+ void Shutdown ()
458
+ {
459
+ delete [] g_EntityPositions;
460
+ delete [] g_EntityOrientations;
461
+ delete [] g_EntityClassnames;
462
+ delete this ;
463
+ }
464
+ };
465
+
453
466
// -----------------------------------------------------------------------------
454
467
// Purpose: Saves the entity's position for future communication with Hammer
455
468
// -----------------------------------------------------------------------------
@@ -460,6 +473,7 @@ void NWCEdit::RememberEntityPosition( CBaseEntity *pEntity )
460
473
461
474
if ( !g_EntityPositions )
462
475
{
476
+ new GlobalCleanUp ();
463
477
g_EntityPositions = new Vector[NUM_ENT_ENTRIES];
464
478
g_EntityOrientations = new QAngle[NUM_ENT_ENTRIES];
465
479
// have to save these too because some entities change the classname on spawn (e.g. prop_physics_override, physics_prop)
You can’t perform that action at this time.
0 commit comments