I've imported a legacy Visual C++ 6.0 application into Visual Studio 2015 and attempted to compile. The .exe compiles OK but when opening a file within the application, I get debug assertions when certain classes are initialized.
The assertion takes place in ..\..\vctools\vc7libs\ship\atlmfc\src\mfc\afxtls.cpp (Line: 22) which is:
Code:void CSimpleList::AddHead(void* p) { ASSERT(p != NULL); ASSERT(*GetNextPtr(p) == NULL); /// <-- This assert is triggered. *GetNextPtr(p) = m_pHead; m_pHead = p; }
The code is called from AfxInit() which is located in :C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\atlmfc\src\mfc\objcore.cpp (Line: 157)
I have a good 100+ classes/objects that initialize fine. I have 12 that trigger this assertion. If I ignore this assertion in debug and continue running the application, I get into trouble with CWnd::SendMessageToDescendants falling into infinite recursion. I suspect that this may be due to AfxClassInit's assertion failure.Code:void AFXAPI AfxClassInit(CRuntimeClass* pNewClass) { AFX_MODULE_STATE* pModuleState = AfxGetModuleState(); AfxLockGlobals(CRIT_RUNTIMECLASSLIST); pModuleState->m_classList.AddHead(pNewClass); AfxUnlockGlobals(CRIT_RUNTIMECLASSLIST); }
What should I be looking at to correct this assertion failure? I know that m_classList.AddHead() expects the GetNextPtr to be NULL, but it's not. What changes in VS2015 would cause this behavior?




Reply With Quote
