Always touch reactive property outside lock and on the mainthread
MODIFY
WalletWasabi.Gui/Models/StatusBarStatuses/StatusSet.cs
WalletWasabi.Gui/Models/StatusBarStatuses/StatusSet.cs
+using Avalonia.Threading;
using ReactiveUI;
using System;
using System.Collections.Generic;
@@ -33,15 +34,21 @@ namespace WalletWasabi.Gui.Models.StatusBarStatuses
lock (ActiveStatusesLock)
{
ret = ActiveStatuses.Add(status);
+ }
+
if (ret)
{
- CurrentStatus = ActiveStatuses.Min();
- }
+ AdjustCurrentStatus();
}
return ret;
}
+ private void AdjustCurrentStatus()
+ {
+ Dispatcher.UIThread.PostLogException(() => CurrentStatus = ActiveStatuses.Min());
+ }
+
public bool TryRemoveStatus(params StatusPriority[] statuses)
{
bool ret = false;
@@ -51,11 +58,11 @@ namespace WalletWasabi.Gui.Models.StatusBarStatuses
{
ret = ActiveStatuses.Remove(status) || ret;
}
+ }
if (ret)
{
- CurrentStatus = ActiveStatuses.Min();
- }
+ AdjustCurrentStatus();
}
return ret;

Always touch reactive property outside lock and on the mainthread