RE: TStreamAdapter need to be freed?

"Richard Le Mesurier (Investec Employee Benefits)" <[email protected]> Thu, 14 Aug 2003 14:56:09 +0200
Newsgroups gmane.comp.lang.delphi.programming
Message-ID <11D85203E297E144933302AFB4A763B9334A2C@iebjhbex2>
The only line in the code that mentions it is:

	(WebBrowser.Document as
IPersistStreamInit).Load(TStreamAdapter.Create(MemStream));

where WebBrowser is a normal TWebBrowser, MemStream is a TMemoryStream
containing HTML text.

Does this satisfy what you say?

Or should I rather create a specific object and free it? Something like...

	MyStreamAd := TStreamAdapter.Create(MemStream);
	try
		(WebBrowser.Document as
IPersistStreamInit).Load(MyStreamAd);
	finally
		MyStreamAd.Free;
	end;

I should say that I am working with code copied from somewhere else, I
didn't write the code myself and so far don't fully understand it, hence the
need for such advice.

-----Original Message-----
From: Marcel Popescu [mailto:[email protected]]
Sent: 14 August 2003 14:51
To: [email protected]
Subject: Re: [Delphi] TStreamAdapter need to be freed?


From: Richard Le Mesurier (Investec Employee Benefits)

> Do you need to explicitly free a TStreamAdapter object?
>
> From the OLH, it is a TInterfacedObject, which I think
> means it will free itself when the interface is no longer
> needed? But I am new to interfaces, so would like to
> confirm that with you guys.

This is only true if you have an interface pointer to it (an IUnknown
pointer in this case).

Mark


NOTICE - This message contains privileged and confidential 
information intended only for the use of the addressee 
named above. Any review, retransmission, dissemination, 
copying, disclosure or other use of, or taking of any 
action in reliance upon, this information by person or 
entities other than the intended recipient is prohibited. 
If you have received this message in error, please notify 
the sender by return email and delete this message. 
This message should not be copied or used for any purpose 
other than intended, nor should it be disclosed to any 
other person. Any views expressed in this message are those 
of the individual sender, except where the sender specifically
 states them to be the view of Investec Group, its 
subsidiaries or associates. The Investec Group is not 
liable for the security of information sent by e-mail at 
your request, nor for the proper and complete transmission 
of the information contained in the communication nor for 
any delay in its receipt. Please note that the recipient 
must scan this e-mail and any attached files for viruses 
and the like. The Investec Group accepts no liability of 
whatever nature for any loss, liability, damage or expense 
resulting directly or indirectly from the access of any files 
which are attached to this message.

------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for Your HP, Epson, Canon or Lexmark
Printer at Myinks.com. Free s/h on orders $50 or more to the US & Canada. http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/l.m7sD/LIdGAA/qnsNAA/i7folB/TM
---------------------------------------------------------------------~->

CodeCoffer - new Delphi 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/