feat: Adds an Item/Mobile memory leak detector. Fixes minor leak in doors. (#2159)
### Summary Adds the command [TrackLeaks to enable tracking item/mobiles that have been deleted but still have dangling references. Requires adding the _TRACK_LEAKS_ define constant during build.
This commit is contained in:
parent
1e349f4369
commit
4aa272d429
9 changed files with 256 additions and 9 deletions
|
|
@ -27,6 +27,8 @@ public partial class SchmendrickApprenticeCorpse : Corpse
|
|||
|
||||
_lantern = new Lantern { Movable = false, Protected = true };
|
||||
_lantern.Ignite();
|
||||
|
||||
Owner = null;
|
||||
}
|
||||
|
||||
private static Mobile GetOwner()
|
||||
|
|
@ -152,5 +154,7 @@ public partial class SchmendrickApprenticeCorpse : Corpse
|
|||
{
|
||||
_lantern.Delete();
|
||||
}
|
||||
|
||||
Owner?.Delete();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -423,6 +423,13 @@ public abstract partial class BaseDoor : Item, ILockable, ITelekinesisable
|
|||
}
|
||||
}
|
||||
|
||||
public override void OnDelete()
|
||||
{
|
||||
_timer?.Stop();
|
||||
_timer = null;
|
||||
Link = null;
|
||||
}
|
||||
|
||||
[AfterDeserialization]
|
||||
private void AfterDeserialization()
|
||||
{
|
||||
|
|
@ -442,6 +449,12 @@ public abstract partial class BaseDoor : Item, ILockable, ITelekinesisable
|
|||
|
||||
protected override void OnTick()
|
||||
{
|
||||
if (_door.Deleted)
|
||||
{
|
||||
Stop();
|
||||
return;
|
||||
}
|
||||
|
||||
if (_door.Open && _door.IsFreeToClose())
|
||||
{
|
||||
_door.Open = false;
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ public partial class Corpse : Container, ICarvable
|
|||
[SerializableField(7, setter: "private")]
|
||||
private List<Mobile> _aggressors;
|
||||
|
||||
[SerializableField(8, setter: "private")]
|
||||
[SerializableField(8, setter: "protected")]
|
||||
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||
private Mobile _owner;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue