Re: Releasing IGraphBuilder
- From: "Nicolas Bernard" <nicolas.bernard@xxxxxxxxxxxxxx>
- Date: Wed, 5 Oct 2005 16:52:41 +0200
GREAT, was just that AddRef I forget... dumb...
I'm going to have a look to that CComPtr...
Tx again for that stupid error,
"Thore Karlsen [MVP DX]" <sid@xxxxxxxx> wrote in message
> On Wed, 5 Oct 2005 16:25:21 +0200, "Nicolas Bernard"
> <nicolas.bernard@xxxxxxxxxxxxxx> wrote:
>>After thinking a little, I ask myself, IGraphBuilder built the graph
>>determining himself which filter to add. By releasing IGraphBuilder, it
>>then release all of them, so does it not release mine too ?
> The basic rule is: Any interface that you have gotten, you need to
> release. IGraphBuilder may hold other references to the same objects,
> but it won't release your references for you.
>>So when I try to release my own CTextureRenderer, IGraphBuilder should
>>already release it, making a pointer error.
> After looking at your code again, I see that you're allocating your
> CTextureRenderer with new, but you're not calling AddRef() on it. That
> is a problem. Try this:
> m_cTextureRenderer = new CTextureRenderer( NULL, &hr );
> Be careful not to explicitly delete m_cTextureRenderer using "delete".
> Since it's used a COM object, the last Release() will delete the object.
>>therefor, I think more and more of using thos CComPtr... But I don't like
>>have so much abstraction.......
> It's not really abstraction, you're not really hiding anything. It's
> just a very useful tool to make sure you don't shoot yourself in the
> foot. :) It makes your code much simpler and easier to read, and that's
> a good thing.
> New to newsgroups? Read: http://dev.6581.com/newsgroups.html