mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2026-11-11 21:16:24 +00:00
Fix race condition in TimerUpdateTrigger stop
This commit is contained in:
1 parent
e332d79a47
commit
1fa466809e
1 file changed
+14
-4
@@ -92,10 +92,20 @@ namespace RGB.NET.Core
|
|||||||
if (UpdateTask != null)
|
if (UpdateTask != null)
|
||||||
{
|
{
|
||||||
UpdateTokenSource?.Cancel();
|
UpdateTokenSource?.Cancel();
|
||||||
// ReSharper disable once MethodSupportsCancellation
|
try
|
||||||
UpdateTask.Wait();
|
{
|
||||||
UpdateTask.Dispose();
|
// ReSharper disable once MethodSupportsCancellation
|
||||||
UpdateTask = null;
|
UpdateTask.Wait();
|
||||||
|
}
|
||||||
|
catch (AggregateException)
|
||||||
|
{
|
||||||
|
// ignored
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
UpdateTask.Dispose();
|
||||||
|
UpdateTask = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user