application crash when exit

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Anyone can help me on this? I have being struggle on this for days and still have no idea yet.
The project which I am working on for years, it is a Cwinapp based mfc window application, but recently, after opened documentation(if not open document crash not happen) , when exit the application, application crashed after theMyApp destructor is called. It is only happen in the release mode(debug work fine!), and I checked all the possible memory problems but couldn’t find anything wrong. It seems after release all the static variable when try to release the variable theApp, crash happened. From the code I can’t see what is that data ofCstringData and pStringMgr seems not valid.
Here is the function crashed and error message as well as call stack.
Error:
Unhandled exception at 0x51723b65 (mfc90u.dll) in MyApp.exe: 0xC0000005: Access violation reading location 0x4600000
In function:
void CstringData::Release() throw()
{
ATLASSERT( nRefs != 0 );
if( _AtlInterlockedDecrement( &nRefs ) <= 0 )
{

pStringMgr->Free( this );//crash here!!!!
}
}
And call stacks are:
mfc90u.dll!ATL::CStringData::Release() Line 111 + 0x2 bytes C++
MyApp.exe! MyApp::~ MyApp() Line 1095 + 0x13 bytes C++
MyApp.exe!`dynamic atexit destructor for theApp() + 0xd bytes C++
msvcr90.dll!doexit(int code=0, int quick=0, int retcaller=0) Line 591
msvcr90.dll!exit(int code=0) Line 412 + 0xc bytes C
MyApp.exe!__tmainCRTStartup() Line 549 C
for kernel32.dll]
ntdll.dll!77e79ef2()
ntdll.dll!77e79ec5()

View the full article
 
Back
Top