[Lazarus] Object free itself?
Lee Jenkins
lee at datatrakpos.com
Thu May 15 21:30:06 CEST 2008
Lee Jenkins wrote:
> Lee Jenkins wrote:
>> 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 Self<>nil 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.
>>
>
> Never mind, I just saved myself a bit of aggravation and created a list manager
> for my controllers which works nicely and free everything from the outside
> without problems.
>
Damn, I spoke too soon. Its still doing it. Apparently, I just cannot call any
kind of code from within the object that somehow frees it?
Is there any way around this?
--
Warm Regards,
Lee
"When my company started out, we were really, really, really, really small.
Now...we're just really small."
More information about the Lazarus
mailing list