修复cc出故障后非lua对象不会自动回收导致内存泄漏

This commit is contained in:
MrZ626
2021-08-22 16:17:49 +08:00
parent cc23869128
commit e3eae25caa
3 changed files with 10 additions and 4 deletions

View File

@@ -230,6 +230,12 @@ end
function Player:setRS(RSname)
self.RS=RSlist[RSname]or RSlist.TRS
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
if self.garbageBeneath==0 then

View File

@@ -189,7 +189,7 @@ function update.alive(P,dt)
if not C[1]then
if P.AI_thread then
if not pcall(P.AI_thread)then
P.AI_thread=nil
P:destroyBot()
end
else
P:act_hardDrop()