dispose characters on unloading plugin
This commit is contained in:
@@ -46,7 +46,7 @@ public sealed class Plugin : IDalamudPlugin
|
||||
|
||||
public Plugin(DalamudPluginInterface pluginInterface, ICommandManager commandManager, IDataManager gameData,
|
||||
IFramework framework, IObjectTable objectTable, IClientState clientState, ICondition condition, IChatGui chatGui,
|
||||
IGameGui gameGui, IDtrBar dtrBar, IToastGui toastGui, IPluginLog pluginLog, ITargetManager targetManager)
|
||||
IGameGui gameGui, IDtrBar dtrBar, IToastGui toastGui, IPluginLog pluginLog, ITargetManager targetManager, IGameLifecycle addonLifecycle)
|
||||
{
|
||||
Plugin.Self = this;
|
||||
_hostBuilderRunTask = new HostBuilder()
|
||||
@@ -78,7 +78,10 @@ public sealed class Plugin : IDalamudPlugin
|
||||
collection.AddSingleton<MareProfileManager>();
|
||||
collection.AddSingleton<GameObjectHandlerFactory>();
|
||||
collection.AddSingleton<FileDownloadManagerFactory>();
|
||||
collection.AddSingleton<PairHandlerFactory>();
|
||||
collection.AddSingleton((s) => new PairHandlerFactory(s.GetRequiredService<ILoggerFactory>(), s.GetRequiredService<GameObjectHandlerFactory>(),
|
||||
s.GetRequiredService<IpcManager>(), s.GetRequiredService<FileDownloadManagerFactory>(), s.GetRequiredService<DalamudUtilService>(),
|
||||
s.GetRequiredService<PluginWarningNotificationService>(), CancellationTokenSource.CreateLinkedTokenSource(addonLifecycle.GameShuttingDownToken, addonLifecycle.DalamudUnloadingToken).Token,
|
||||
s.GetRequiredService<FileCacheManager>(), s.GetRequiredService<MareMediator>()));
|
||||
collection.AddSingleton<PairFactory>();
|
||||
collection.AddSingleton<CharacterAnalyzer>();
|
||||
collection.AddSingleton<TokenProvider>();
|
||||
@@ -152,6 +155,6 @@ public sealed class Plugin : IDalamudPlugin
|
||||
{
|
||||
_pluginCts.Cancel();
|
||||
_pluginCts.Dispose();
|
||||
Task.WaitAny(_hostBuilderRunTask);
|
||||
_hostBuilderRunTask.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user