最近程序中加入异常捕获之后,发现代码退出时会不可避免的出现dmp文件。调试后发现,总是在exit后,析构一个单例对象时出错。 跟进去可以确定是由于xml解析析构时出错的。
下面是堆栈
> .exe!ATL::CComPtrBase<IXMLDOMDocument2>::~CComPtrBase<IXMLDOMDocument2>() Line 134 + 0xa bytes C++
.exe!ATL::CComPtr<IXMLDOMDocument2>::~CComPtr<IXMLDOMDocument2>() + 0x2b bytes C++
.exe!CInterfaceCallingWrapper<IXMLDOMDocument2>::~CInterfaceCallingWrapper<IXMLDOMDocument2>() Line 292 + 0x37 bytes C++
.exe!CXMLDOMDocument2::~CXMLDOMDocument2() + 0x2b bytes C++
.exe!CPolicyManage::~CPolicyManage() Line 14 + 0x13 bytes C++
.exe!`CPolicyManage::GetInstanceRef'::`2'::`dynamic atexit destructor for '_instance''() + 0x28 bytes C++
.exe!doexit(int code=0, int quick=0, int retcaller=0) Line 553 C
.exe!exit(int code=0) Line 398 + 0xd bytes C
.exe!__tmainCRTStartup() Line 333 C
.exe!wmainCRTStartup() Line 196 C
kernel32.dll!7c82f23b()
[Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]
.exe!CDC::SetBkMode(int nBkMode=7209065) Line 305 + 0x18 bytes C++
.exe!CImageList::Create(unsigned int nBitmapID=116, int cx=6881357, int nGrow=7471203, unsigned long crMask=7536751) Line 1364 + 0x9 bytes C++
.exe!CWnd::FilterToolTipMessage(tagMSG * pMsg=0x00740073) Line 380 + 0x4c bytes C++
.exe!CXMLHTTPRequest::GetResponseStream() Line 2707 C++
.exe!CDC::SetBkMode(int nBkMode=7274601) Line 305 + 0x18 bytes C++
.exe!CDC::SetBkMode(int nBkMode=7274601) Line 305 + 0x18 bytes C++
.exe!CDC::SetBkMode(int nBkMode=7274601) Line 305 + 0x18 bytes C++
.exe!CDC::SetBkMode(int nBkMode=7602291) Line 305 + 0x18 bytes C++
.exe!CXMLHTTPRequest::GetResponseStream() Line 2707 C++
.exe!CWnd::Dump(CDumpContext & dc={...}) Line 936 + 0x1 bytes C++
.exe!CWnd::Dump(CDumpContext & dc={...}) Line 936 + 0x1 bytes C++
.exe!CWnd::GetDC() Line 136 + 0x27 bytes C++
ffec258f()
看了几个用了同样类似的程序,都有这样的错误,就说以前李同学说,c盘的dmp文件有2k多个了。终于知道为啥了,因为老大在使用 CXMLDOMDocument2 m_Doc; 作为成员函数,析构的时候没有调用 Detach()加上detach 4个组件的退出,由这个问题引起的异常就搞定了。 eps的服务器也有这个问题。
折腾了半天,NND