1
0
mirror of https://github.com/DarthAffe/RGB.NET.git synced 2025-12-13 10:08:31 +00:00

Merge pull request #231 from DarthAffe/Core/UpdateTriggerCancel

Fix race condition in TimerUpdateTrigger stop
This commit is contained in:
Robert Beekman 2021-09-03 20:40:14 +02:00 committed by GitHub
commit 3074a2b7bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;
}
} }
} }
} }