fix thread safety on plugin warning notification service

This commit is contained in:
rootdarkarchon
2023-05-09 15:52:47 +02:00
parent 70732de3bb
commit 529b8e4c37
2 changed files with 3 additions and 1 deletions

View File

@@ -416,6 +416,7 @@ public sealed class PairHandler : DisposableMediatorSubscriberBase
else if (_charaHandler?.Address == nint.Zero && IsVisible)
{
IsVisible = false;
_charaHandler?.Invalidate();
Logger.LogTrace("{this} visibility changed, now: {visi}", this, IsVisible);
}
}

View File

@@ -4,12 +4,13 @@ using MareSynchronos.API.Data.Comparer;
using MareSynchronos.Interop;
using MareSynchronos.MareConfiguration;
using MareSynchronos.Services.Mediator;
using System.Collections.Concurrent;
namespace MareSynchronos.PlayerData.Pairs;
public class PluginWarningNotificationService
{
private readonly Dictionary<UserData, OptionalPluginWarning> _cachedOptionalPluginWarnings = new(UserDataComparer.Instance);
private readonly ConcurrentDictionary<UserData, OptionalPluginWarning> _cachedOptionalPluginWarnings = new(UserDataComparer.Instance);
private readonly IpcManager _ipcManager;
private readonly MareConfigService _mareConfigService;
private readonly MareMediator _mediator;