Newsgroups : Borland : borland.public.delphi.rtl.win32 : 2006 Aug : FreeAndNil never calls the destructor

www.cryer.info
Managed Newsgroup Archive

FreeAndNil never calls the destructor

Subject:FreeAndNil never calls the destructor
Posted by:"Tony Blomfield" (ton..@sailaway.co.nz)
Date:Thu, 10 Aug 2006 21:48:05 +1200

HI.

I have a very basic problem.

I have a simple class which inherits from TObject.

In the constructor I instansiate a few objects - IBQuerys, transactions,
etc.

In the Destructor I destroy these objects.

Very simple - Except they dont get destroyed.

Supose I have some code like this

Button1.click.

var
    Obj: TMyObject.
begin
    Obj := TMyObject.Crewate;
    try
        Obj.DoIt;
    frinally
      FreeAndNil(obj);
  end;
Maybe I have been too long in .NEWT.

FreeAndNil appears to be called, except that the Objects that are supposed
to be Destroyed in Obj.Destroy, are not destroyed.

What am I doing wrong (May I been too long in .NET now)

Replies:

www.cryer.info
Managed Newsgroup Archive