refactor: make all PluginInterface classes explicitly disposable

This commit is contained in:
goaaats 2022-01-08 03:00:56 +01:00
parent 33f230fa75
commit 2d90598b70
No known key found for this signature in database
GPG key ID: F18F057873895461
16 changed files with 43 additions and 29 deletions

View file

@ -15,6 +15,7 @@ using Dalamud.Game.Network.Internal;
using Dalamud.Hooking;
using Dalamud.IoC;
using Dalamud.IoC.Internal;
using Dalamud.Utility;
using Serilog;
namespace Dalamud.Game.ClientState
@ -136,11 +137,11 @@ namespace Dalamud.Game.ClientState
/// <summary>
/// Dispose of managed and unmanaged resources.
/// </summary>
public void Dispose()
void IDisposable.Dispose()
{
this.setupTerritoryTypeHook.Dispose();
Service<Condition>.Get().Dispose();
Service<GamepadState>.Get().Dispose();
Service<Condition>.Get().ExplicitDispose();
Service<GamepadState>.Get().ExplicitDispose();
Service<Framework>.Get().Update -= this.FrameworkOnOnUpdateEvent;
Service<NetworkHandlers>.Get().CfPop -= this.NetworkHandlersOnCfPop;
}

View file

@ -136,7 +136,7 @@ namespace Dalamud.Game.ClientState.Conditions
/// <summary>
/// Disposes this instance, alongside its hooks.
/// </summary>
public void Dispose()
void IDisposable.Dispose()
{
GC.SuppressFinalize(this);
this.Dispose(true);

View file

@ -175,7 +175,7 @@ namespace Dalamud.Game.ClientState.GamePad
/// <summary>
/// Disposes this instance, alongside its hooks.
/// </summary>
public void Dispose()
void IDisposable.Dispose()
{
this.Dispose(true);
GC.SuppressFinalize(this);

View file

@ -135,10 +135,10 @@ namespace Dalamud.Game
/// <summary>
/// Dispose of managed and unmanaged resources.
/// </summary>
public void Dispose()
void IDisposable.Dispose()
{
Service<GameGui>.GetNullable()?.Dispose();
Service<GameNetwork>.GetNullable()?.Dispose();
Service<GameGui>.GetNullable()?.ExplicitDispose();
Service<GameNetwork>.GetNullable()?.ExplicitDispose();
this.updateHook?.Disable();
this.destroyHook?.Disable();

View file

@ -139,7 +139,7 @@ namespace Dalamud.Game.Gui
/// <summary>
/// Dispose of managed and unmanaged resources.
/// </summary>
public void Dispose()
void IDisposable.Dispose()
{
this.printMessageHook.Dispose();
this.populateItemLinkHook.Dispose();

View file

@ -444,12 +444,12 @@ namespace Dalamud.Game.Gui
/// <summary>
/// Disables the hooks and submodules of this module.
/// </summary>
public void Dispose()
void IDisposable.Dispose()
{
Service<ChatGui>.Get().Dispose();
Service<ToastGui>.Get().Dispose();
Service<FlyTextGui>.Get().Dispose();
Service<PartyFinderGui>.Get().Dispose();
Service<ChatGui>.Get().ExplicitDispose();
Service<ToastGui>.Get().ExplicitDispose();
Service<FlyTextGui>.Get().ExplicitDispose();
Service<PartyFinderGui>.Get().ExplicitDispose();
this.setGlobalBgmHook.Dispose();
this.handleItemHoverHook.Dispose();
this.handleItemOutHook.Dispose();

View file

@ -61,9 +61,9 @@ namespace Dalamud.Game.Gui.PartyFinder
}
/// <summary>
/// Dispose of m anaged and unmanaged resources.
/// Dispose of managed and unmanaged resources.
/// </summary>
public void Dispose()
void IDisposable.Dispose()
{
this.receiveListingHook.Dispose();

View file

@ -110,7 +110,7 @@ namespace Dalamud.Game.Gui.Toast
/// <summary>
/// Disposes of managed and unmanaged resources.
/// </summary>
public void Dispose()
void IDisposable.Dispose()
{
this.showNormalToastHook.Dispose();
this.showQuestToastHook.Dispose();

View file

@ -72,7 +72,7 @@ namespace Dalamud.Game.Network
/// <summary>
/// Dispose of managed and unmanaged resources.
/// </summary>
public void Dispose()
void IDisposable.Dispose()
{
this.processZonePacketDownHook.Dispose();
this.processZonePacketUpHook.Dispose();