First-chance exception at std::set dectructor
- by bartek
Hi, I have a strange exception at my class destructor:
First-chance exception reading location 0x00000
class DispLst{
// For fast instance existance test
std::set< std::string > instances;
[...]
DispLst::~DispLst(){
this->clean();
DeleteCriticalSection( &instancesGuard );
} <---- here instances destructor raises exception
Call stack:
X.exe!std::_Tree,std::allocator ,std::less,std::allocator ,std::allocator,std::allocator ,0 ::begin() Line 556 + 0xc bytes C++
X.exe!std::_Tree,std::allocator ,std::less,std::allocator ,std::allocator,std::allocator ,0 ::_Tidy() Line 1421 + 0x64 bytes C++
X.exe!std::_Tree,std::allocator ,std::less,std::allocator ,std::allocator,std::allocator ,0 ::~_Tree,std::allocator ,std::less,std::allocator ,std::allocator,std::allocator ,0 () Line 541 C++
X.exe!std::set,std::allocator ,std::less,std::allocator ,std::allocator,std::allocator ::~set,std::allocator ,std::less,std::allocator ,std::allocator,std::allocator () + 0x2b bytes C++
X.exe!DispLst::~DispLst() Line 82 + 0xf bytes C++
The exact place of error in xtree:
void _Tidy()
{ // free all storage
erase(begin(), end()); <------------------- HERE
this->_Alptr.destroy(&_Left(_Myhead));
this->_Alptr.destroy(&_Parent(_Myhead));
this->_Alptr.destroy(&_Right(_Myhead));
this->_Alnod.deallocate(_Myhead, 1);
_Myhead = 0, _Mysize = 0;
}
iterator begin()
{ // return iterator for beginning of mutable sequence
return (_TREE_ITERATOR(_Lmost())); <---------------- HERE
}
What is going on ?
I'm using Visual Studio 2008.