Skip to content

Commit

Permalink
fix serverside EGP.ScrHW memory leak (#2107)
Browse files Browse the repository at this point in the history
  • Loading branch information
storm37000 authored Dec 6, 2020
1 parent 13d6bdb commit fd492dc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
5 changes: 1 addition & 4 deletions lua/entities/gmod_wire_egp/lib/egplib/usefulfunctions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions lua/entities/gmod_wire_expression2/core/egpfunctions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit fd492dc

Please sign in to comment.