Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Windos
win32.3rdparty
win32.directx.audio
win32.directx.ddk
win32.directx.graphics
win32.directx.input
win32.directx.managed
win32.directx.misc
win32.directx.networking
win32.directx.sdk
win32.directx.video
win32.dirx.grap.shaders
win32.gdi
win32.international
win32.kernel
win32.messaging
win32.mmedia
win32.networks
win32.ole
win32.rtc
win32.tapi
win32.tapi.beta
win32.tools
win32.ui
win32.wince
win32.wmi
windows.mediacenter
winfx.aero
winfx.announcements
winfx.avalon
winfx.collaboration
winfx.fundamentals
winfx.general
winfx.indigo
winfx.sdk
winfx.winfs
  
 
date: Fri, 19 Sep 2008 12:00:57 +0200,    group: microsoft.public.win32.programmer.directx.video        back       


Access violation on Graph.CoCreateInstance   
Hi,

I have player application which first initialize all filters add to graph 
and go to run mode. That goes well. Than when i press stop it goes to stop 
mode and release all filters, mediaevent, mediacontrol and graph (in that 
order). Now when i call play again i get access violation on:

hr = pGraph.CoCreateInstance(CLSID_FilterGraph);

What is causing this ?

    Thanx
date: Fri, 19 Sep 2008 12:00:57 +0200   author:   Gossamer

Re: Access violation on Graph.CoCreateInstance   
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.

Roman
date: Fri, 19 Sep 2008 04:45:18 -0700 (PDT)   author:   Roman Ryl...

Re: Access violation on Graph.CoCreateInstance   
"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
date: Fri, 19 Sep 2008 14:09:33 +0200   author:   Gossamer

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

Re: Access violation on Graph.CoCreateInstance   
Hi,

> 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?

CComPtr::Release is safe to call (unlike CComPtr::p->Release you might
have thought of). And CoCreateInstance assumes current value of member
pointer p is NULL, so Release before CoCreateInstance is safe and
basically required if the variable is re-creating a pointer.

Roman
date: Fri, 19 Sep 2008 07:13:19 -0700 (PDT)   author:   Roman Ryl...

Re: Access violation on Graph.CoCreateInstance   
"Michel Roujansky - Senior developer, Starfish Technologies Ltd"
 wrote:
>
>You are using smart pointers, so you should not free the objects using
>Release().

If you want to create a new object with the same smart pointer, you MUST
call Release (or set it to 0).  CComPtr::QueryInterface will assert if the
pointer it contains is not NULL.
-- 
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.
date: Sat, 20 Sep 2008 21:14:32 -0700   author:   Tim Roberts

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us