mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-14 04:34: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;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
using Dalamud.Configuration.Internal;
|
using Dalamud.Configuration.Internal;
|
||||||
|
|
@ -59,9 +60,9 @@ namespace Dalamud.Hooking
|
||||||
this.address = address;
|
this.address = address;
|
||||||
if (this.isMinHook)
|
if (this.isMinHook)
|
||||||
{
|
{
|
||||||
var indexList = hasOtherHooks
|
if (!HookManager.MultiHookTracker.TryGetValue(address, out var indexList))
|
||||||
? HookManager.MultiHookTracker[address]
|
indexList = HookManager.MultiHookTracker[address] = new();
|
||||||
: (HookManager.MultiHookTracker[address] = new());
|
|
||||||
var index = (ulong)indexList.Count;
|
var index = (ulong)indexList.Count;
|
||||||
|
|
||||||
this.minHookImpl = new MinSharp.Hook<T>(address, detour, index);
|
this.minHookImpl = new MinSharp.Hook<T>(address, detour, index);
|
||||||
|
|
@ -191,7 +192,9 @@ namespace Dalamud.Hooking
|
||||||
if (this.isMinHook)
|
if (this.isMinHook)
|
||||||
{
|
{
|
||||||
this.minHookImpl.Dispose();
|
this.minHookImpl.Dispose();
|
||||||
HookManager.MultiHookTracker[this.address] = null;
|
|
||||||
|
var index = HookManager.MultiHookTracker[this.address].IndexOf(this);
|
||||||
|
HookManager.MultiHookTracker[this.address][index] = null;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue