Re: Passing Smart Pointers as Parameters



To do this, I stumbled
over the _ATL_DEBUG_INTERFACES macro. Unfortunately, this does not
seem to work in my setup here: I inserted it in stdafx.h before
including atlbase.h, but in my own COM objects, I don't get the debug
output when calling QI/AddRef/Release (respectively when the smart
pointers call these functions).

How do you obtain interface pointers on your own object? If you want
debugging wrappers, you must go through QueryInterface, and not, say,
directly casting 'this' pointer.

It's not the problem with the interfaces on my object. The problem
occurs with the interfaces of other objects. For example the
IHTMLElement of a object in the browser's DOM. I tried it manually
with QI as well as with CComQIPtr--both variants don't provide any
debug output...

So obviously, I'm always going through the QI for these and thus
should see the debug output, right? Any idea of a potential problem?

Thanks,

Stefan

--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925


.



Relevant Pages

  • Re: The Failure of OOP
    ... >> Hi Calum, ... > could definitely rig something that will show interfaces in your favour. ... In some scenarios you would have more pointers than objects, ... Christopher Diggins ...
    (comp.object)
  • Re: Release build seg faults at vector.push_back above certain size, b
    ... >i'm using a vectors of pointers in my code. ... >the whole thing get's really strange when i use the debug build. ... set the warning level to 4 and define ... deleteptr; ...
    (microsoft.public.dotnet.languages.vc)
  • Re: strang behaviour std:vector and XString in VC6.0
    ... > In the debug version I've the following problem: ... > After I've added a couple of pointers using the push_back function and I ... > iterate over x the program crashes in the iteration loop. ... an uninitialised variable which happens to get one value in debug mode and a ...
    (comp.lang.cpp)
  • Re: Setting pointer to null!
    ... debug builds do not and AFAIK have never done that. ... yourself and initialise it NULL on a release build. ... and I think they use a repeated 0xCD pattern. ... if you "defensively" initialize all pointers to ...
    (microsoft.public.vc.language)
  • Re: strang behaviour std:vector and XString in VC6.0
    ... > In the debug version I've the following problem: ... > After I've added a couple of pointers using the push_back function and I ... > iterate over x the program crashes in the iteration loop. ... example of not more than 20 lines which uses no non-standard C++ ...
    (comp.lang.cpp)