I was wondering whether any of you have used com_ptr_t and if you have, does it really do what it says?
I'm running into problems with COM interface pointers and I'm not sure everything is being released correctly.
I was wondering whether any of you have used com_ptr_t and if you have, does it really do what it says?
I'm running into problems with COM interface pointers and I'm not sure everything is being released correctly.
Yup, all the time. I use ATL's CComPtr though. Probably very similar in function I assume.
"...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers
Does it save COM pointer headaches and how do I go about using it correctly.
The prototypes look quite confusing.
It's pretty straight forward, you would have something like this in your header:
Oh, also include <atlbase.h> in your precompiled header or other appropriate location.Code:CComPtr<IDirect3DDevice9> m_device;
Then the other use is identical as if it were a IDirect3DDevice9*. Just don't release it and you'll be fine. Do you have any other specific question? Try it out, I think you'll find it pretty easy to use.
"...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers