Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > ATL bug of CComPtr?

Reply
Thread Tools

ATL bug of CComPtr?

 
 
George2 George2 is offline
Senior Member
Join Date: Feb 2008
Posts: 108
 
      04-07-2008
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
aspx page, C#, trying to instantiate a C++ ATL COM control WTH ASP .Net 1 11-01-2004 10:36 PM
HELP !!! Managed C++, WinForms and ATL !!! Dmitry ASP .Net 0 11-01-2004 07:27 PM
could not start ASP.NET or ATL Server Debugging Tarundeep Singh Kalra ASP .Net 2 04-13-2004 05:12 AM
Q: Which one is better for parsing 30MB files ? ATL/COM or VB/COM Ramie MCSD 11 10-30-2003 09:22 PM
My ATL com activex control not working in C# & VB .net Sunil George ASP .Net 1 08-06-2003 08:34 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57