mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
fix: lock timing handle list while using
This commit is contained in:
parent
36780f43a8
commit
d079bc1fbf
1 changed files with 8 additions and 3 deletions
|
|
@ -19,6 +19,7 @@ public sealed class TimingHandle : TimingEvent, IDisposable, IComparable<TimingH
|
|||
{
|
||||
this.Stack = Timings.TaskTimingHandles;
|
||||
|
||||
lock (this.Stack)
|
||||
this.Parent = this.Stack.LastOrDefault();
|
||||
|
||||
if (this.Parent != null)
|
||||
|
|
@ -36,6 +37,7 @@ public sealed class TimingHandle : TimingEvent, IDisposable, IComparable<TimingH
|
|||
this.EndTime = this.StartTime;
|
||||
this.IsMainThread = ThreadSafety.IsMainThread;
|
||||
|
||||
lock (this.Stack)
|
||||
this.Stack.Add(this);
|
||||
}
|
||||
|
||||
|
|
@ -78,7 +80,10 @@ public sealed class TimingHandle : TimingEvent, IDisposable, IComparable<TimingH
|
|||
public void Dispose()
|
||||
{
|
||||
this.EndTime = Timings.Stopwatch.Elapsed.TotalMilliseconds;
|
||||
|
||||
lock (this.Stack)
|
||||
this.Stack.Remove(this);
|
||||
|
||||
if (this.Duration > 1 || this.ChildCount > 0)
|
||||
{
|
||||
lock (Timings.AllTimings)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue