Code: Select all
/*
I'm trying to update Elgin's TypeLib2AHK https://www.autohotkey.com/boards/viewtopic.php?f=6&t=36025
Amazing piece of code for someone like me needing to learn about UIAutomation.
Wondering if this class constructor can result in a dangling pointer? I failed to figure out how I can test for that...
*/
#Persistent
point:=new tagPOINT()
ListVars
class tagPOINT
{
__New(byref p="empty")
{
If (p="empty")
{
VarSetCapacity(p,this.__SizeOf(),0)
}
ObjInsert(this, "__Value", &p) ; <-- when a parameter is not passed (i.e. p="empty"), isn't this pointing to a string buffer for local variable "p" whose memory will be released after __NEW() returns? i.e. doesn't this result in a dangling pointer?
}
}