Fix issue with IPC adding mods before character utility is ready in rare cases.

This commit is contained in:
Ottermandias 2025-01-22 23:14:09 +01:00
parent dcab443b2f
commit 40168d7daf
5 changed files with 60 additions and 15 deletions

View file

@ -71,7 +71,7 @@ public class CollectionCacheManager : IDisposable, IService
_communicator.ModDiscoveryFinished.Subscribe(OnModDiscoveryFinished, ModDiscoveryFinished.Priority.CollectionCacheManager);
if (!MetaFileManager.CharacterUtility.Ready)
MetaFileManager.CharacterUtility.LoadingFinished += IncrementCounters;
MetaFileManager.CharacterUtility.LoadingFinished.Subscribe(IncrementCounters, CharacterUtilityFinished.Priority.CollectionCacheManager);
}
public void Dispose()
@ -83,7 +83,7 @@ public class CollectionCacheManager : IDisposable, IService
_communicator.ModOptionChanged.Unsubscribe(OnModOptionChange);
_communicator.ModSettingChanged.Unsubscribe(OnModSettingChange);
_communicator.CollectionInheritanceChanged.Unsubscribe(OnCollectionInheritanceChange);
MetaFileManager.CharacterUtility.LoadingFinished -= IncrementCounters;
MetaFileManager.CharacterUtility.LoadingFinished.Unsubscribe(IncrementCounters);
foreach (var collection in _storage)
{
@ -298,7 +298,7 @@ public class CollectionCacheManager : IDisposable, IService
{
foreach (var collection in _storage.Where(c => c.HasCache))
collection.Counters.IncrementChange();
MetaFileManager.CharacterUtility.LoadingFinished -= IncrementCounters;
MetaFileManager.CharacterUtility.LoadingFinished.Unsubscribe(IncrementCounters);
}
private void OnModSettingChange(ModCollection collection, ModSettingChange type, Mod? mod, Setting oldValue, int groupIdx, bool _)