Crash generated during destruction of hash_map
Posted
by Alien01
on Stack Overflow
See other posts from Stack Overflow
or by Alien01
Published on 2010-06-15T07:15:04Z
Indexed on
2010/06/15
7:42 UTC
Read the original article
Hit count: 296
I am using hash_map in application as
typedef hash_map<DWORD,CComPtr<IInterfaceXX>> MapDword2Interface;
In main application I am using static instance of this map
static MapDword2Interface m_mapDword2Interface;
I have got one crash dump from one of the client machines which point to the crash in clearing this map
I opened that crash dump and here is assembly during debugging
> call std::list<std::pair<unsigned long const ,ATL::CComPtr<IInterfaceXX> >,std::allocator<std::pair<unsigned long const ,ATL::CComPtr<IInterfaceXX> > > >::clear
> mov eax,dword ptr [CMainApp::m_mapDword2Interface+8 (49XXXXX)]
Here is code where crash dump is pointing. Below code is from stl:list file
void clear()
{ // erase all
#if _HAS_ITERATOR_DEBUGGING
this->_Orphan_ptr(*this, 0);
#endif /* _HAS_ITERATOR_DEBUGGING */
_Nodeptr _Pnext;
_Nodeptr _Pnode = _Nextnode(_Myhead);
_Nextnode(_Myhead) = _Myhead;
_Prevnode(_Myhead) = _Myhead;
_Mysize = 0;
for (; _Pnode != _Myhead; _Pnode = _Pnext)
{ // delete an element
_Pnext = _Nextnode(_Pnode);
this->_Alnod.destroy(_Pnode);
this->_Alnod.deallocate(_Pnode, 1);
}
}
Crash is pointing to the this->_Alnod.destroy(_Pnode)
; statement in above code.
I am not able to guess it, what could be reason.
Any ideas???
How can I make sure, even is there is something wrong with the map , it should not crash?
© Stack Overflow or respective owner