Weird crash when using criticalObject() and hotkey, ifwinactive

Post a reply

Confirmation code
Enter the code exactly as it appears. All letters are case insensitive.
Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :| :mrgreen: :geek: :ugeek: :arrow: :angel: :clap: :crazy: :eh: :lolno: :problem: :shh: :shifty: :sick: :silent: :think: :thumbup: :thumbdown: :salute: :wave: :wtf: :yawn: :facepalm: :bravo: :dance: :beard: :morebeard: :xmas: :HeHe: :trollface: :cookie: :rainbow: :monkeysee: :monkeysay: :happybday: :headwall: :offtopic: :superhappy: :terms: :beer:
View more smilies

BBCode is ON
[img] is OFF
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Weird crash when using criticalObject() and hotkey, ifwinactive

Re: Weird crash when using criticalObject() and hotkey, ifwinactive

by SpeedMaster » 10 Apr 2018, 14:53

Yep, it was just a bet because I know that such a thing can lead to a crash in ahk. :twisted:

Good luck :!:

Re: Weird crash when using criticalObject() and hotkey, ifwinactive

by bichlepa » 10 Apr 2018, 13:21

But .. I don't see any recursive function calls. Not even a function is defined.

Re: Weird crash when using criticalObject() and hotkey, ifwinactive

by SpeedMaster » 09 Apr 2018, 11:31

Lexikos wrote:Script function recursion is limited by available stack space
https://autohotkey.com/board/topic/4372 ... ashes-ahk/
Maybe this has to do with a recursive function call. :evil:

https://en.wikipedia.org/wiki/Stack_overflow

Weird crash when using criticalObject() and hotkey, ifwinactive

by bichlepa » 08 Apr 2018, 05:36

Try this out:

Main.ahk

Code: Select all

FileRead,ThreadCode,% "Thread.ahk"
	
_share:=criticalObject()
AhkThread := AhkThread("_share:=CriticalObject(" &_share ")`n" ThreadCode)

MsgBox klick ok to terminate
if (AhkThread.ahkReady())
{
	AhkThread.ahkterminate(-100)

}
ExitApp
Thread.ahk

Code: Select all

CoordMode,ToolTip,screen
parentAHKThread := AhkExported()
hotkey, ifwinactive, asdf ;Remove this line and it will not crash
Loop
{
	;Or remove those tree lines an it will not crash
	_share.index:=A_Index
	if (_share.index / 1000 == _share.index // 1000)
		ToolTip % _share.index
}
return
It will always crash.
crash.png
crash.png (6.23 KiB) Viewed 419 times
Is there a bug in this code or in AutoHotkey_H (v 1.1.28.0)?

Top