Skip to content

Commit

Permalink
fix: fixing AddLateEvent tmp list
Browse files Browse the repository at this point in the history
since list is static, invoking a 2nd AddLateEvent from an event would re-use the tmp list and throw
  • Loading branch information
James-Frowen committed Mar 29, 2024
1 parent 4b74379 commit 619b91d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Assets/Mirage/Runtime/Events/AddLateEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ namespace Mirage.Events
[Serializable]
public class AddLateEvent : AddLateEventBase, IAddLateEvent
{
private static readonly List<Action> tmp = new List<Action>();
private readonly List<Action> tmp = new List<Action>();
private readonly List<Action> _listeners = new List<Action>();

public void AddListener(Action handler)
Expand Down Expand Up @@ -109,7 +109,7 @@ public virtual void Invoke()
[Serializable]
public class AddLateEvent<T0> : AddLateEventBase, IAddLateEvent<T0>
{
private static readonly List<Action<T0>> tmp = new List<Action<T0>>();
private readonly List<Action<T0>> tmp = new List<Action<T0>>();
private readonly List<Action<T0>> _listeners = new List<Action<T0>>();

protected T0 _arg0;
Expand Down Expand Up @@ -154,7 +154,7 @@ public virtual void Invoke(T0 arg0)
[Serializable]
public class AddLateEvent<T0, T1> : AddLateEventBase, IAddLateEvent<T0, T1>
{
private static readonly List<Action<T0, T1>> tmp = new List<Action<T0, T1>>();
private readonly List<Action<T0, T1>> tmp = new List<Action<T0, T1>>();
private readonly List<Action<T0, T1>> _listeners = new List<Action<T0, T1>>();

protected T0 _arg0;
Expand Down

0 comments on commit 619b91d

Please sign in to comment.