Skip to content

Commit 0982a99

Browse files
authored
Bugfix - DllManipulator.UnloadAll()
Delegate fields of native functions were not nulled out when dll was unloaded, which caused calls to stale native delegate.
1 parent 1b0bfa8 commit 0982a99

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/DllManipulator.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,11 @@ public static void UnloadAll()
153153
dll.loadingError = false;
154154
dll.symbolError = false;
155155

156+
foreach(var func in dll.functions)
157+
{
158+
func.@delegate = null;
159+
}
160+
156161
if(!success)
157162
{
158163
Debug.LogWarning($"Error while unloading DLL \"{dll.name}\" at path \"{dll.path}\"");
@@ -440,4 +445,4 @@ public enum LinuxDlopenFlags : int
440445
Lazy_Global = 0x00100 | Lazy,
441446
Now_Global = 0x00100 | Now
442447
}
443-
}
448+
}

0 commit comments

Comments
 (0)