Fix race condition in TimerUpdateTrigger stop

This commit is contained in:
Robert committed 2021-08-23 18:48:19 +02:00
1 parent e332d79a47
commit 1fa466809e
1 file changed
+14 -4
+14 -4
View File
@@ -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;
}
}
}
}