From fd492dc171f6fdcb563d41dbb8121504ec5ac598 Mon Sep 17 00:00:00 2001 From: storm37000 <6331913+storm37000@users.noreply.github.com> Date: Sun, 6 Dec 2020 00:08:18 -0500 Subject: [PATCH] fix serverside EGP.ScrHW memory leak (#2107) --- .../gmod_wire_egp/lib/egplib/usefulfunctions.lua | 5 +---- .../gmod_wire_expression2/core/egpfunctions.lua | 12 ++++++------ 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/lua/entities/gmod_wire_egp/lib/egplib/usefulfunctions.lua b/lua/entities/gmod_wire_egp/lib/egplib/usefulfunctions.lua index 1b07f508ed..47fb651878 100644 --- a/lua/entities/gmod_wire_egp/lib/egplib/usefulfunctions.lua +++ b/lua/entities/gmod_wire_egp/lib/egplib/usefulfunctions.lua @@ -225,12 +225,9 @@ else end end) end) - - EGP.ScrHW = {} - concommand.Add("EGP_ScrWH",function(ply,cmd,args) if (args and tonumber(args[1]) and tonumber(args[2])) then - EGP.ScrHW[ply] = { tonumber(args[1]), tonumber(args[2]) } + ply.EGP_ScrHW = { tonumber(args[1]), tonumber(args[2]) } end end) end diff --git a/lua/entities/gmod_wire_expression2/core/egpfunctions.lua b/lua/entities/gmod_wire_expression2/core/egpfunctions.lua index 2d2c84fafa..a7cd88e4db 100644 --- a/lua/entities/gmod_wire_expression2/core/egpfunctions.lua +++ b/lua/entities/gmod_wire_expression2/core/egpfunctions.lua @@ -1002,18 +1002,18 @@ end __e2setcost(10) e2function vector2 egpScrSize( entity ply ) - if (!ply or !ply:IsValid() or !ply:IsPlayer() or !EGP.ScrHW[ply]) then return {-1,-1} end - return EGP.ScrHW[ply] + if (!ply or !ply:IsValid() or !ply:IsPlayer() or !ply.EGP_ScrHW) then return {-1,-1} end + return ply.EGP_ScrHW end e2function number egpScrW( entity ply ) - if (!ply or !ply:IsValid() or !ply:IsPlayer() or !EGP.ScrHW[ply]) then return -1 end - return EGP.ScrHW[ply][1] + if (!ply or !ply:IsValid() or !ply:IsPlayer() or !ply.EGP_ScrHW[1]) then return -1 end + return ply.EGP_ScrHW[1] end e2function number egpScrH( entity ply ) - if (!ply or !ply:IsValid() or !ply:IsPlayer() or !EGP.ScrHW[ply]) then return -1 end - return EGP.ScrHW[ply][2] + if (!ply or !ply:IsValid() or !ply:IsPlayer() or !ply.EGP_ScrHW[2]) then return -1 end + return ply.EGP_ScrHW[2] end __e2setcost(15)