Avoid more $this refs on long-life closures

This commit is contained in:
Dylan K. Taylor
2021-05-06 14:27:56 +01:00
parent c356abb917
commit 7b2c6c5ceb
4 changed files with 11 additions and 8 deletions

View File

@@ -447,8 +447,9 @@ class World implements ChunkManager{
unset($this->generatorRegisteredWorkers[$workerId]);
}
});
$this->addOnUnloadCallback(function() use ($workerStartHook) : void{
$this->workerPool->removeWorkerStartHook($workerStartHook);
$workerPool = $this->workerPool;
$this->addOnUnloadCallback(static function() use ($workerPool, $workerStartHook) : void{
$workerPool->removeWorkerStartHook($workerStartHook);
});
}