From:
http://www.autohotkey.com/forum/viewtopic.php?p=34830
Quote:
...the following should die gracelessly:
Code:
#t::
clipboard = 1
CrashMe()
CrashMe()
{
clipboard := clipboard + 1
CrashMe()
}
*tries it* Yup, there we go:
Quote:
Program Error
AutoHotkey.exe has generated errors and will be closed by Windows. You will need to restart the program.
An error log is being created.
I guess Chris could avoid this by setting a max calling level, beyond which threads would die with a popup, rather than kill the whole script. Using the above code, it looped 160 times on my system before dying (or at least, I had the value 160 in my clipboard after the crash).
So, yeah, that'd be a kindof nice feature to have: just a popup to say "maximum number of nested function calls reached, stack usage dangerously high, terminating the thread but leaving ahk still running so that your hotkeys still work.".
And maybe add "Would you like to disable the hotkey that caused this? Y/N".
If there's some kindof windowsy magic that could be used to automagically detect when the stack was running out, that'd be best, but otherwise, maybe a default to something like 100 or 150, user-definable with #MaxNesting or something. Which has the advantage that they can allow themselves to crash if they want to.