修复cc出故障后非lua对象不会自动回收导致内存泄漏
This commit is contained in:
@@ -59,7 +59,7 @@ if type(_CC)=='table'then
|
|||||||
end
|
end
|
||||||
error("Row "..y.." full")
|
error("Row "..y.." full")
|
||||||
]]
|
]]
|
||||||
P.AI_thread=nil
|
P:destroyBot()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -68,12 +68,12 @@ if type(_CC)=='table'then
|
|||||||
n=n+1
|
n=n+1
|
||||||
end
|
end
|
||||||
if not pcall(CC.update,P.AI_bot,F,P.b2b>=100,P.combo)then
|
if not pcall(CC.update,P.AI_bot,F,P.b2b>=100,P.combo)then
|
||||||
P.AI_thread=nil
|
P:destroyBot()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function CC.switch20G(P)
|
function CC.switch20G(P)
|
||||||
if not pcall(CC.destroy,P.AI_bot)then
|
if not pcall(CC.destroy,P.AI_bot)then
|
||||||
P.AI_thread=nil
|
P:destroyBot()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
P.AIdata._20G=true
|
P.AIdata._20G=true
|
||||||
|
|||||||
@@ -230,6 +230,12 @@ end
|
|||||||
function Player:setRS(RSname)
|
function Player:setRS(RSname)
|
||||||
self.RS=RSlist[RSname]or RSlist.TRS
|
self.RS=RSlist[RSname]or RSlist.TRS
|
||||||
end
|
end
|
||||||
|
function Player:destroyBot()
|
||||||
|
if self.AI_mode=='CC'then
|
||||||
|
if self.AI_bot then CC.destroy(self.AI_bot)end
|
||||||
|
end
|
||||||
|
self.AI_thread=nil
|
||||||
|
end
|
||||||
|
|
||||||
function Player:getHolePos()--Get a good garbage-line hole position
|
function Player:getHolePos()--Get a good garbage-line hole position
|
||||||
if self.garbageBeneath==0 then
|
if self.garbageBeneath==0 then
|
||||||
|
|||||||
@@ -189,7 +189,7 @@ function update.alive(P,dt)
|
|||||||
if not C[1]then
|
if not C[1]then
|
||||||
if P.AI_thread then
|
if P.AI_thread then
|
||||||
if not pcall(P.AI_thread)then
|
if not pcall(P.AI_thread)then
|
||||||
P.AI_thread=nil
|
P:destroyBot()
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
P:act_hardDrop()
|
P:act_hardDrop()
|
||||||
|
|||||||
Reference in New Issue
Block a user