I have an application where I create a Popup menu class (lets say TNewPopupMenu) that inherited from TPopupMenu (that is created in the vcl)
On Create changing the class using
Procedure T.ChangeClass;
type
PClass = ^TClass;
Begin
PClass(FEventPopup)^ := TNewPopupMenu;
TNewPopupMenu(FEventPopup).OnDismissed := CallbackDismissPopUpMenu;
End;
If I leave like this I get a error when the application closes and try to free FEventPopup, I try to do this so solve:
destructor T.Destroy;
type
PClass = ^TClass;
begin
TNewPopupMenu(FEventPopup).OnDismissed := nil;
PClass(FEventPopup)^ := TPopupMenu;
inherited;
end;
But I still getting an exception when the main form try to free FEventPopup, what else do I need to do?