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,7 +19,8 @@ public sealed class TimingHandle : TimingEvent, IDisposable, IComparable<TimingH
|
||||||
{
|
{
|
||||||
this.Stack = Timings.TaskTimingHandles;
|
this.Stack = Timings.TaskTimingHandles;
|
||||||
|
|
||||||
this.Parent = this.Stack.LastOrDefault();
|
lock (this.Stack)
|
||||||
|
this.Parent = this.Stack.LastOrDefault();
|
||||||
|
|
||||||
if (this.Parent != null)
|
if (this.Parent != null)
|
||||||
{
|
{
|
||||||
|
|
@ -36,7 +37,8 @@ public sealed class TimingHandle : TimingEvent, IDisposable, IComparable<TimingH
|
||||||
this.EndTime = this.StartTime;
|
this.EndTime = this.StartTime;
|
||||||
this.IsMainThread = ThreadSafety.IsMainThread;
|
this.IsMainThread = ThreadSafety.IsMainThread;
|
||||||
|
|
||||||
this.Stack.Add(this);
|
lock (this.Stack)
|
||||||
|
this.Stack.Add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -78,7 +80,10 @@ public sealed class TimingHandle : TimingEvent, IDisposable, IComparable<TimingH
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
this.EndTime = Timings.Stopwatch.Elapsed.TotalMilliseconds;
|
this.EndTime = Timings.Stopwatch.Elapsed.TotalMilliseconds;
|
||||||
this.Stack.Remove(this);
|
|
||||||
|
lock (this.Stack)
|
||||||
|
this.Stack.Remove(this);
|
||||||
|
|
||||||
if (this.Duration > 1 || this.ChildCount > 0)
|
if (this.Duration > 1 || this.ChildCount > 0)
|
||||||
{
|
{
|
||||||
lock (Timings.AllTimings)
|
lock (Timings.AllTimings)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue