Re: Who's in charge of AddRef'ing?
- From: alamaison <newsgroups@xxxxxxxxxxx>
- Date: Tue, 27 Jan 2009 14:47:19 -0800
Roman Ryl... wrote:
CComPtr<IChild> m_pChild;
STDMETHOD(get_child)(IChild** ppChild)
{
if(!ppChild)
return E_POINTER;
*ppChild = CComPtr<IChild>(m_pChild).Detach(); // leave AddRef on
stack, in the out'ted variable
I'm not sure this is a good idea for a 'get' method. Detach() destroys
the existing reference (m_pChild) which CopyTo() does not.
.
- Follow-Ups:
- Re: Who's in charge of AddRef'ing?
- From: Igor Tandetnik
- Re: Who's in charge of AddRef'ing?
- References:
- Who's in charge of AddRef'ing?
- From: Igor R.
- Re: Who's in charge of AddRef'ing?
- From: Roman Ryl...
- Who's in charge of AddRef'ing?
- Prev by Date: Re: Who's in charge of AddRef'ing?
- Next by Date: Re: Who's in charge of AddRef'ing?
- Previous by thread: Re: Who's in charge of AddRef'ing?
- Next by thread: Re: Who's in charge of AddRef'ing?
- Index(es):
Relevant Pages
|