fix: use -1 as ProcessHandle for ActorTable read hack

This commit is contained in:
goat 2020-08-08 12:59:34 +02:00
parent e1d82d8c72
commit 162ba3f894

View file

@ -43,7 +43,7 @@ namespace Dalamud.Game.ClientState.Actors {
private static readonly int ActorMemSize = Marshal.SizeOf(typeof(Structs.Actor)); private static readonly int ActorMemSize = Marshal.SizeOf(typeof(Structs.Actor));
private IntPtr actorMem = Marshal.AllocHGlobal(ActorMemSize); private IntPtr actorMem = Marshal.AllocHGlobal(ActorMemSize);
private Process currentProcess = Process.GetCurrentProcess(); private IntPtr currentProcessHandle = new IntPtr(-1);
#endregion #endregion
@ -81,7 +81,7 @@ namespace Dalamud.Game.ClientState.Actors {
{ {
try { try {
// FIXME: hack workaround for trying to access the player on logout, after the main object has been deleted // FIXME: hack workaround for trying to access the player on logout, after the main object has been deleted
if (!ReadProcessMemory(this.currentProcess.Handle, offset, this.actorMem, ActorMemSize, out _)) if (!ReadProcessMemory(this.currentProcessHandle, offset, this.actorMem, ActorMemSize, out _))
{ {
Log.Debug("ActorTable - ReadProcessMemory failed: likely player deletion during logout"); Log.Debug("ActorTable - ReadProcessMemory failed: likely player deletion during logout");
return null; return null;