TInterfaceList is descended from TInterfacedObject, so it needs to be referenced with an interface to keeps it's reference count above 0 - else it will be destroyed along with all the objects it contains.

eg,

TMyObject = class(TObject)
private
  FInterfaceList : IInterfaceList;
public
  constructor create;
end;

constructor TMyObject.create;
begin
  FInterfaceList := TInterfaceList; // automatic typecast to IInterfaceList
end;

Conor Boyd wrote:
Can you clarify that for me?
 
Why does it *need* to be referenced with an IInterfaceList?
 
I've just started using a  TInterfaceList to hold references to interfaces, but I don't see why I have to use interfaces WRT the list itself?
 
Having said that, I have an issue where I have to explicitly call _AddRef on the interface I'm adding to my interfacelist to keep it alive.  Could these two things be related?
 
Grateful for your thoughts...
 
C.


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Phil Middlemiss
 
No, it wasn't a typo - he needs to *create* a TInterfaceList - but that list needs to be *referenced* with an IInterfaceList. It was intentional to force Thomas to look up how to end up with a working IInterfaceList.

Conor Boyd wrote:
I'm sure it was just a typo, but it should be a TInterfaceList instead of a TList.
 
Cheers,
 
Conor


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Phil Middlemiss
 
[snip]
 
You should also be adding it to an IInterfaceList instead of a TList.

[snip]


_______________________________________________ Delphi mailing list [email protected] http://ns3.123.co.nz/mailman/listinfo/delphi


begin:vcard
fn:Phil Middlemiss
n:Middlemiss;Phil
org:Vision Software, MTS Ltd
email;internet:[EMAIL PROTECTED]
title:Project Leader
tel;work:+64 7 3480001
tel;cell:+64 27 4592648
x-mozilla-html:TRUE
url:http://www.tumonz.co.nz
version:2.1
end:vcard

_______________________________________________
Delphi mailing list
[email protected]
http://ns3.123.co.nz/mailman/listinfo/delphi

Reply via email to