mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-17 21:37:43 +01:00
refactor: make all PluginInterface classes explicitly disposable
This commit is contained in:
parent
33f230fa75
commit
2d90598b70
16 changed files with 43 additions and 29 deletions
|
|
@ -19,6 +19,7 @@ using Dalamud.Plugin.Internal;
|
|||
using Dalamud.Plugin.Ipc;
|
||||
using Dalamud.Plugin.Ipc.Exceptions;
|
||||
using Dalamud.Plugin.Ipc.Internal;
|
||||
using Dalamud.Utility;
|
||||
|
||||
namespace Dalamud.Plugin
|
||||
{
|
||||
|
|
@ -383,9 +384,9 @@ namespace Dalamud.Plugin
|
|||
/// <summary>
|
||||
/// Unregister your plugin and dispose all references.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
void IDisposable.Dispose()
|
||||
{
|
||||
this.UiBuilder.Dispose();
|
||||
this.UiBuilder.ExplicitDispose();
|
||||
Service<ChatGui>.Get().RemoveChatLinkHandler(this.pluginName);
|
||||
Service<Localization>.Get().LocalizationChanged -= this.OnLocalizationChanged;
|
||||
Service<DalamudConfiguration>.Get().DalamudConfigurationSaved -= this.OnDalamudConfigurationSaved;
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ using Dalamud.Logging.Internal;
|
|||
using Dalamud.Plugin.Internal.Exceptions;
|
||||
using Dalamud.Plugin.Internal.Loader;
|
||||
using Dalamud.Plugin.Internal.Types;
|
||||
using Dalamud.Utility;
|
||||
|
||||
namespace Dalamud.Plugin.Internal
|
||||
{
|
||||
|
|
@ -209,7 +210,7 @@ namespace Dalamud.Plugin.Internal
|
|||
this.instance?.Dispose();
|
||||
this.instance = null;
|
||||
|
||||
this.DalamudInterface?.Dispose();
|
||||
this.DalamudInterface?.ExplicitDispose();
|
||||
this.DalamudInterface = null;
|
||||
|
||||
this.pluginType = null;
|
||||
|
|
@ -332,7 +333,7 @@ namespace Dalamud.Plugin.Internal
|
|||
if (this.instance == null)
|
||||
{
|
||||
this.State = PluginState.LoadError;
|
||||
this.DalamudInterface.Dispose();
|
||||
this.DalamudInterface.ExplicitDispose();
|
||||
Log.Error($"Error while loading {this.Name}, failed to bind and call the plugin constructor");
|
||||
return;
|
||||
}
|
||||
|
|
@ -382,7 +383,7 @@ namespace Dalamud.Plugin.Internal
|
|||
this.instance?.Dispose();
|
||||
this.instance = null;
|
||||
|
||||
this.DalamudInterface?.Dispose();
|
||||
this.DalamudInterface?.ExplicitDispose();
|
||||
this.DalamudInterface = null;
|
||||
|
||||
this.pluginType = null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue