procedure TOtherObject.RegisterEvent(Event: TNotifyEvent);
begin
FHookList.Add(@Event);
end;
There you go.... A TNotifyEvent is not a pointer, it is a "record" with a Code and data pointer.
What you add to FHookList is the address if this record, located somewhere on stack, which is void after you leave RegisterEvent
Use something like:
type
PNotifyEvent = ^TNotifyEvent;
procedure TOtherObject.RegisterEvent(Event: TNotifyEvent);
var
p: PNotifyEvent;
begin
New(p);
p^ := Event;
FHookList.Add(p);
end;
when clearing or removing items from the list, call Dispose(p);