Fix memory leak from object pools.

This commit is contained in:
2023-04-21 12:18:29 +08:00
parent c39a02a1c2
commit 2784544884
4 changed files with 27 additions and 10 deletions

View File

@@ -178,7 +178,7 @@ namespace Cryville.Crtr.Event {
if (s.CloneType == 2) SetGraphicalActive(false, s);
else SetPreGraphicalActive(false, s);
}
anchorEvPool.Return(tev);
ReturnAnchorEvent(tev);
}
else if (RootTransform && s.CloneType == 2) MatchDynamic(s, 2);
}
@@ -245,9 +245,14 @@ namespace Cryville.Crtr.Event {
}
public virtual void Discard(ContainerState s, StampedEvent ev) {
if (ev is StampedEvent.Anchor) {
anchorEvPool.Return((StampedEvent.Anchor)ev);
ReturnAnchorEvent((StampedEvent.Anchor)ev);
}
}
void ReturnAnchorEvent(StampedEvent.Anchor ev) {
ev.Container = null;
ev.Target = null;
anchorEvPool.Return(ev);
}
#endregion
#endregion