Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
tools
vsnet.act
vsnet.debugging
vsnet.documentation
vsnet.enterprise.tools
vsnet.general
vsnet.ide
vsnet.jlca
vsnet.servicepacks
vsnet.setup
vsnet.vsip
vsnet.vss
vsnet.vstools.office
vstudio.development
vstudio.extensibility
vstudio.general
vstudio.helpauthoring
vstudio.setup
vstudio.sourcesafe
  
 
date: Wed, 13 Aug 2008 00:25:01 -0700,    group: microsoft.public.vstudio.development        back       


validating COM pointer in release builds   
I am using a piece of code like this:

CDOCSObject * pObject = NULL;
map<CString, CDOCSObjectCacheItem *>::iterator cacheItr = 
m_DOCSObjectCache.find(strID);
if ( cacheItr != m_DOCSObjectCache.end() )
{
	pObject = (*cacheItr).second->m_pObject;
	pObject->AddRef();		
}
return pObject;

pObject->AddRef() is throwing an access violation error in release builds.

I tried to validate pObject using 
if(pObject != NULL) and IsBadReadPtr() etc but doesnt help.
It still throws same error in release build. Is there a way to check for 
validity of COM pointer in release build.

Thanks in advance
Chandan
date: Wed, 13 Aug 2008 00:25:01 -0700   author:   balaji chandan

Re: validating COM pointer in release builds   
How about using try-catch?
date: Fri, 15 Aug 2008 00:55:57 -0700 (PDT)   author:   titilima

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us