> I can't see how the existance of an .empty property should make any
> difference.
> If you .Create'd an object, you should .Free it too. Being .empty or
> not shouldn't have anything to do with it
It's a clear misunderstanding about what Free does and the difference
between
the Container, the Contents and the Reference to the Container.
1 var
2 A :TMyBitmap;
3 begin
4 A := TMyBitmap.Create;
5 A.LoadFromFile('Mybitmap.bmp');
6 A.Free;
7 end;
A is a reference to an object. if it's 'nil' then itn't currently
referencing an object
TMyBitmap is the Type of the object that A will refer to and line 4 is
creating an
instance of the TMyBitmap object and setting A to 'point' to that new
instance.
Line 5 loads data into the Instance pointed to by A.
Line 6 calls Free on A which says:
if A isn't nil then it's pointing to an object so call the 'Destroy'
method of the object
pointed to by A.
The destroy method is 'responsible' for managing the release of any
information inside
the object - so you don't have to free it.
So in this example
A is the Reference to the Container
The Container is an instance of TMyBitmap
The Contents is the data loaded from 'MyBitmap.bmp' and will be freed when
the 'Destroy'
is called through A.Free.
--
Aaron@home
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz