Re: Mixing ATL smart pointers with regular calls
- From: Thore Karlsen [MVP DX] <sid@xxxxxxxx>
- Date: Sun, 11 Sep 2005 18:06:48 -0500
On Mon, 12 Sep 2005 00:03:53 +0200, Piotr Gutkowski
<beztego_gutkowski@xxxxxxxxxxx> wrote:
>Hello,
>
>I use CComPtr<> templates to define interface pointers in main()
>function of my application. Certain pointers are then passes to other
>functions, which initialize them. For example, to create a filter graph,
> i use:
>
>CComPtr<ICaptureGraphBuilder2> pBuild;
>CComPtr<IGraphBuilder> pGraph;
>
>and then I pass them to:
>
>InitCaptureGraphBuilder(&pGraph,&pBuild);
>
>Inside this function, there is a regular call:
>
>HRESULT hr = CoCreateInstance(CLSID_CaptureGraphBuilder2, NULL,
> CLSCTX_INPROC_SERVER, IID_ICaptureGraphBuilder2, (void**)&pBuild);
>
>One may ask, why I mix these two approaches. The answer is, that I am
>reusing certain functions and I am not interested in their body until I
>know what they do.
>
>However, I believe that it is the cause of a runtime error. Could you
>please confirm that such mixing is dangerous?
There is no problem mixing smart pointers with regular calls. Your
problem is not caused by smart pointers as such, but may be caused by
your specific usage. It's hard to say without knowing exactly what the
runtime error is. If you run your program in a debugger, where does the
error occur, and what error do you get?
--
New to newsgroups? Read: http://dev.6581.com/newsgroups.html
.
- References:
- Mixing ATL smart pointers with regular calls
- From: Piotr Gutkowski
- Mixing ATL smart pointers with regular calls
- Prev by Date: Mixing ATL smart pointers with regular calls
- Next by Date: Re: Mixing ATL smart pointers with regular calls
- Previous by thread: Mixing ATL smart pointers with regular calls
- Next by thread: Re: Mixing ATL smart pointers with regular calls
- Index(es):
Relevant Pages
|