HotKeyIt/ahkdll

ahkPause doesn't work as expected

jayquonmarton opened this issue · 1 comments

ahkPause (See https://github.com/HotKeyIt/ahkdll/blob/alpha/source/exports.cpp#L189-L192 ) doesn't work as expected because line 192 sets g->IsPaused to false instead of true and decrements g_nPausedThreads instead of increments (and maybe other issues?). Additionally, it also seg faults if you pass 0 as the argument, because the conditional on line 189 attempts to dereference address 0x0.

Regardless of the argument passed to it ("On", "Off", 1), it always returns 0, and it never causes the thread to pause (including the tray icon never turning red). The only thing it appears to do is unpause an already paused thread that has been paused by calling Pause within the ahk script e.g. something like,

#Persistent
loop {
  ToolTip(A_TickCount)
  sleep 1000
  pause
}

With the above script that pauses itself, you can unpause it by calling ahkPause.

However, if you remove the pause line from the loop, ahkPause fails to pause the script when called.

I'm using https://github.com/HotKeyIt/ahkdll-v2-release/blob/master/x64w/AutoHotkey.dll to test this.

Thanks, that should be fixed.