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