|
-
April 7th, 2008, 12:41 AM
#1
ATL bug of CComPtr?
Hello everyone,
In the ATL Internals book, one form of constructor of CComQIPtr is implemented as this,
Code:
CComQIPtr (IUnknown* lp)
{
p = NULL; if (lp != NULL) lp -> QueryInterface (*piid, (void**)&p);
}
I think there is a bug when QueryInterface fails, and the original value of member variable p is overwritten.
I found the in MSVC 2008, the implementation is,
Code:
atlcomcli.h
CComQIPtr(_In_opt_ IUnknown* lp) throw()
{
if (lp != NULL)
lp->QueryInterface(*piid, (void **)&p);
}
Seems the bug is fixed? Is it a bug in old version of ATL or a bug in the book? :-)
thanks in advance,
George
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|