I've never tried this type of thing before, but I have need to have an object free self.
After freeing any resource used by the object in it's Destructor, I call inherited destroy and it looks like the inherited destroy methods works, but right afterward, get a sig exception in LCLProc.unit:
function TMethodList.Count: integer;
begin
if Selfnil then
Result:=FCount <== here
else
Result:=0;
end;Is it even possible to have an object free itself?
BTW, I'm trying my hand at creaing an MVC and I need the controller to be able to free itself because it is the object that 1) Creates the View (form) and 2) the Model (object) and mediates between them.
When the form is closed, the controller is notified and need to 1) free the form
2) free the model/object and 3) free itself.
Otherwise, I guess I must create some kind of manager object/list to free the controller from the outside. Note: If I free the controller object from outside (like putting it in an objectlist and calling ObjectList.clear) there is no exception.
Just calling free from the object itself poses the problem.
Thanks for input.
