Disposal safety

This commit is contained in:
Zeffuro
2026-01-02 23:42:12 +01:00
parent aec704dece
commit 7cec19f5f2
5 changed files with 32 additions and 23 deletions
@@ -217,7 +217,7 @@ public class InventoryLifecycles : IDisposable
Services.AddonLifecycle.UnregisterListener(AddonEvent.PreRefresh, ["Inventory", "InventoryLarge", "InventoryExpansion"]); Services.AddonLifecycle.UnregisterListener(AddonEvent.PreRefresh, ["Inventory", "InventoryLarge", "InventoryExpansion"]);
Services.AddonLifecycle.UnregisterListener(AddonEvent.PreRefresh, ["InventoryBuddy"]); Services.AddonLifecycle.UnregisterListener(AddonEvent.PreRefresh, ["InventoryBuddy"]);
Services.AddonLifecycle.UnregisterListener(AddonEvent.PreRefresh, ["InventoryRetainer, InventoryRetainerLarge"]); Services.AddonLifecycle.UnregisterListener(AddonEvent.PreRefresh, ["InventoryRetainer", "InventoryRetainerLarge"]);
Services.AddonLifecycle.UnregisterListener(AddonEvent.PostRequestedUpdate, "Inventory", OnInventoryUpdate); Services.AddonLifecycle.UnregisterListener(AddonEvent.PostRequestedUpdate, "Inventory", OnInventoryUpdate);
Services.AddonLifecycle.UnregisterListener(AddonEvent.PostRequestedUpdate, "InventoryBuddy", OnSaddleBagUpdate); Services.AddonLifecycle.UnregisterListener(AddonEvent.PostRequestedUpdate, "InventoryBuddy", OnSaddleBagUpdate);
+1 -2
View File
@@ -145,9 +145,8 @@ public abstract unsafe class InventoryAddonBase : NativeAddon, IInventoryWindow
if (SearchInputNode != null) if (SearchInputNode != null)
{ {
bool atActive = !string.IsNullOrEmpty(HighlightState.SelectedAllaganToolsFilterKey); bool atActive = !string.IsNullOrEmpty(HighlightState.SelectedAllaganToolsFilterKey);
bool filterModeActive = System.Config.General.SearchMode == SearchMode.Filter;
SearchInputNode.HintAddColor = (atActive || filterModeActive) SearchInputNode.HintAddColor = (atActive)
? new Vector3(0.0f, 0.3f, 0.3f) ? new Vector3(0.0f, 0.3f, 0.3f)
: Vector3.Zero; : Vector3.Zero;
} }
@@ -2,6 +2,7 @@ using System;
using AetherBags.Configuration; using AetherBags.Configuration;
using AetherBags.Inventory; using AetherBags.Inventory;
using AetherBags.Inventory.Context; using AetherBags.Inventory.Context;
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
using KamiToolKit.Classes.ContextMenu; using KamiToolKit.Classes.ContextMenu;
namespace AetherBags.Addons; namespace AetherBags.Addons;
@@ -71,4 +72,13 @@ public static class InventoryAddonContextMenu
menu.Open(); menu.Open();
} }
public static unsafe void Close()
{
var agent = AgentContext.Instance();
if (agent != null)
{
agent->ClearMenu();
}
}
} }
+1
View File
@@ -14,5 +14,6 @@ public class IPCService : IDisposable
{ {
AllaganTools.Dispose(); AllaganTools.Dispose();
WotsIt.Dispose(); WotsIt.Dispose();
BisBuddy.Dispose();
} }
} }
+9 -10
View File
@@ -5,6 +5,7 @@ using AetherBags.Commands;
using AetherBags.Helpers; using AetherBags.Helpers;
using AetherBags.Hooks; using AetherBags.Hooks;
using AetherBags.Inventory; using AetherBags.Inventory;
using AetherBags.Inventory.Context;
using AetherBags.Inventory.State; using AetherBags.Inventory.State;
using AetherBags.IPC; using AetherBags.IPC;
using Dalamud.Game.Gui; using Dalamud.Game.Gui;
@@ -42,14 +43,14 @@ public unsafe class Plugin : IDalamudPlugin
System.AddonSaddleBagWindow = new AddonSaddleBagWindow System.AddonSaddleBagWindow = new AddonSaddleBagWindow
{ {
InternalName = "AetherBags_SaddleBag", InternalName = "AetherBags_SaddleBag",
Title = "AetherBags", Title = "AetherSaddlebag",
Size = new Vector2(750, 750), Size = new Vector2(750, 750),
}; };
System.AddonRetainerWindow = new AddonRetainerWindow System.AddonRetainerWindow = new AddonRetainerWindow
{ {
InternalName = "AetherBags_Retainer", InternalName = "AetherBags_Retainer",
Title = "AetherBags", Title = "AetherRetainerbag",
Size = new Vector2(750, 750), Size = new Vector2(750, 750),
}; };
@@ -78,22 +79,20 @@ public unsafe class Plugin : IDalamudPlugin
public void Dispose() public void Dispose()
{ {
System.IPC.Dispose(); InventoryAddonContextMenu.Close();
Util.SaveConfig(System.Config); _inventoryHooks.Dispose();
Services.ClientState.Login -= OnLogin; _inventoryLifecycles.Dispose();
Services.ClientState.Logout -= OnLogout;
_commandHandler.Dispose(); System.IPC.Dispose();
HighlightState.ClearAll();
System.AddonInventoryWindow.Dispose(); System.AddonInventoryWindow.Dispose();
System.AddonSaddleBagWindow.Dispose(); System.AddonSaddleBagWindow.Dispose();
System.AddonRetainerWindow.Dispose(); System.AddonRetainerWindow.Dispose();
System.AddonConfigurationWindow.Dispose(); System.AddonConfigurationWindow.Dispose();
Util.SaveConfig(System.Config);
KamiToolKitLibrary.Dispose(); KamiToolKitLibrary.Dispose();
_inventoryHooks.Dispose();
_inventoryLifecycles.Dispose();
} }
private void OnLogin() private void OnLogin()