mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-14 11:57:42 +01:00
fix: Attempt to better handle hook disposal (#1803)
- Use a Weak Concurrent Collection to track scoped hooks - Make `Hook`s remove themselves from the Tracked Hook list.
This commit is contained in:
parent
203d80c602
commit
a2124bb73d
8 changed files with 67 additions and 21 deletions
|
|
@ -258,8 +258,6 @@ internal class PluginStatWindow : Window
|
|||
ImGui.EndTabItem();
|
||||
}
|
||||
|
||||
var toRemove = new List<Guid>();
|
||||
|
||||
if (ImGui.BeginTabItem("Hooks"))
|
||||
{
|
||||
ImGui.Checkbox("Show Dalamud Hooks", ref this.showDalamudHooks);
|
||||
|
|
@ -291,9 +289,6 @@ internal class PluginStatWindow : Window
|
|||
{
|
||||
try
|
||||
{
|
||||
if (trackedHook.Hook.IsDisposed)
|
||||
toRemove.Add(guid);
|
||||
|
||||
if (!this.showDalamudHooks && trackedHook.Assembly == Assembly.GetExecutingAssembly())
|
||||
continue;
|
||||
|
||||
|
|
@ -355,14 +350,6 @@ internal class PluginStatWindow : Window
|
|||
}
|
||||
}
|
||||
|
||||
if (ImGui.IsWindowAppearing())
|
||||
{
|
||||
foreach (var guid in toRemove)
|
||||
{
|
||||
HookManager.TrackedHooks.TryRemove(guid, out _);
|
||||
}
|
||||
}
|
||||
|
||||
ImGui.EndTabBar();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue