Fixed inventory cyclic references causing players to not get garbage-collected

This commit is contained in:
Dylan K. Taylor 2017-08-23 13:13:15 +01:00
parent 770616d4ab
commit da4c9cf404
2 changed files with 3 additions and 0 deletions

View File

@ -3503,6 +3503,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
$this->removeAllWindows(true); $this->removeAllWindows(true);
$this->windows = null; $this->windows = null;
$this->windowIndex = []; $this->windowIndex = [];
$this->cursorInventory = null;
if($this->constructed){ if($this->constructed){
parent::close(); parent::close();

View File

@ -537,6 +537,8 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
foreach($this->inventory->getViewers() as $viewer){ foreach($this->inventory->getViewers() as $viewer){
$viewer->removeWindow($this->inventory); $viewer->removeWindow($this->inventory);
} }
$this->inventory = null;
} }
parent::close(); parent::close();
} }