mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-13 12:14:16 +01:00
Solve minhook crash on plugin reload
This commit is contained in:
parent
5380141d76
commit
eca4ce05fd
1 changed files with 7 additions and 4 deletions
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
|
||||
using Dalamud.Configuration.Internal;
|
||||
|
|
@ -59,9 +60,9 @@ namespace Dalamud.Hooking
|
|||
this.address = address;
|
||||
if (this.isMinHook)
|
||||
{
|
||||
var indexList = hasOtherHooks
|
||||
? HookManager.MultiHookTracker[address]
|
||||
: (HookManager.MultiHookTracker[address] = new());
|
||||
if (!HookManager.MultiHookTracker.TryGetValue(address, out var indexList))
|
||||
indexList = HookManager.MultiHookTracker[address] = new();
|
||||
|
||||
var index = (ulong)indexList.Count;
|
||||
|
||||
this.minHookImpl = new MinSharp.Hook<T>(address, detour, index);
|
||||
|
|
@ -191,7 +192,9 @@ namespace Dalamud.Hooking
|
|||
if (this.isMinHook)
|
||||
{
|
||||
this.minHookImpl.Dispose();
|
||||
HookManager.MultiHookTracker[this.address] = null;
|
||||
|
||||
var index = HookManager.MultiHookTracker[this.address].IndexOf(this);
|
||||
HookManager.MultiHookTracker[this.address][index] = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue