Re: Re: Component and Interface (solved)

Markus Ostenried <[email protected]>
Newsgroups gmane.comp.lang.delphi.programming
Message-ID <[email protected]>
At 13:30 Friday, 11.07.2003 +0000, Tony wrote:
>May be wrong about this but I think Components do not use the AddRef
>and Release methods to do anything meaningful so if you override
>these with a simple refcounting scheme it may work...

Yes, you're right. Setting the interface variable to nil didn't change 
anything. This is from the source of TComponent and TInterfacedObject:

function TComponent._Release: Integer;
begin
   if FVCLComObject = nil then
     Result := -1   // -1 indicates no reference counting is taking place
   else
     Result := IVCLComObject(FVCLComObject)._Release;
end;

function TInterfacedObject._Release: Integer;
begin
   Result := InterlockedDecrement(FRefCount);
   if Result = 0 then
     Destroy;
end;

I just copied the code from TInterfaceObject's _AddRef and _Release methods 
and now it works fine.
Thanks,
Markus 


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Natural Vitamins for Good Prostate & Male Health. $28.97
http://www.challengerone.com/t/l.asp?cid=2865&lp=prosta2.html
http://us.click.yahoo.com/qJIe0D/89VGAA/ySSFAA/i7folB/TM
---------------------------------------------------------------------~->

CodeCoffer the new code protection tool!
http://www.delphicollection.com/public/CodeCoffer.htm
---------------------------------------------------------------
Unsubscribe:[email protected]
List owner:[email protected]
--------------------------------------------------------------- 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.