|
|
|
date: Fri, 19 Sep 2008 12:00:57 +0200,
group: microsoft.public.win32.programmer.directx.video
back
Re: Access violation on Graph.CoCreateInstance
On Sep 19, 2:09 pm, "Gossamer" wrote:
> "Roman Ryl..." wrote in message
>
> news:c57fbefd-3d4d-40cc-9fb7-eeffb62cf14b@8g2000hse.googlegroups.com...
>
> > Hi,
>
> >> hr = pGraph.CoCreateInstance(CLSID_FilterGraph);
>
> >> What is causing this ?
>
> > If you have an access violation, you should also have a call stack at
> > exact access violation position. It would be helpful if you pasted it
> > into the topic.
>
> > If you really have the problem on this line, I'd suspect you still
> > have a non-NULL value in pGraph variable (what is the type?
> > CComPtr<IGraphBuilder> ?) but the actual object behind the pointer was
> > already destroyed.
>
> It is CComPtr<IGraphBuilder>. The value of pGraph is 0 before call. Before
> CoCreate i use pGraph.Release() so the object is destroyed.
> also there are those two interfaces derived from pGraph
> hr = pGraph->QueryInterface(IID_IMediaControl, (void **)&pControl);
> hr = pGraph->QueryInterface(IID_IMediaEvent, (void **)&pEvent);
> which i also Release before reinitialize pGraph.
>
>
>
> > Roman- Hide quoted text -
>
> - Show quoted text -
You are using smart pointers, so you should not free the objects using
Release(). And also, why don't you keep your graph and reuse it?
date: Fri, 19 Sep 2008 06:31:06 -0700 (PDT)
author: Michel Roujansky - Senior developer, Starfish Technologies Ltd
|
|