PermissibleBase: more robust cycle destruction

This commit is contained in:
Dylan K. Taylor
2020-12-01 17:57:55 +00:00
parent 87033592b1
commit c20893aa4b
2 changed files with 8 additions and 7 deletions

View File

@@ -152,12 +152,6 @@ class PermissibleBase implements Permissible{
Timings::$permissibleCalculationTimer->stopTiming();
}
public function clearPermissions() : void{
PermissionManager::getInstance()->unsubscribeFromAllPermissions($this->getRootPermissible());
$this->permissions = [];
}
/**
* @param bool[] $children
*/
@@ -181,4 +175,11 @@ class PermissibleBase implements Permissible{
public function getEffectivePermissions() : array{
return $this->permissions;
}
public function destroyCycles() : void{
PermissionManager::getInstance()->unsubscribeFromAllPermissions($this->getRootPermissible());
$this->permissions = []; //PermissionAttachmentInfo doesn't reference Permissible anymore, but it references PermissionAttachment which does
$this->attachments = []; //this might still be a problem if the attachments are still referenced, but we can't do anything about that
$this->parent = null;
}
}