int CWinThread::Run()中崩溃,提示MSVCRTD.DLL中有错误,急,在线等待
添加一个消息映射,点击时弹出一个对话框。消息映射都是对的,函数实现体中也就只有一个AfxMessage("test")。但是弹出对话框后,会崩溃,debug跟踪,发现是在CWinThread::Run()中崩溃,不知道该怎么解决。
int CWinThread::Run()
{
ASSERT_VALID(this);
// for tracking the idle time state
BOOL bIdle = TRUE;
LONG lIdleCount = 0;
// acquire and dispatch messages until a WM_QUIT message is received.
for (;;)
{
// phase1: check to see if we can do idle work
while (bIdle &&
!::PeekMessage(&m_msgCur, NULL, NULL, NULL, PM_NOREMOVE))
{
// call OnIdle while in bIdle state
if (!OnIdle(lIdleCount++))
bIdle = FALSE; // assume "no idle" state
}
// phase2: pump messages while available
do
{
// pump message, but quit on WM_QUIT
if (!PumpMessage())
return ExitInstance();
// reset "no idle" state after pumping "normal" message
if (IsIdleMessage(&m_msgCur))
{
bIdle = TRUE;
lIdleCount = 0;
}
} while (::PeekMessage(&m_msgCur, NULL, NULL, NULL, PM_NOREMOVE));
}
ASSERT(FALSE); // not reachable
}
在这个函数中,do循环循环到一定时候,就会提示错误,程序崩溃,然后看call stack,最后一个函数是strcat,但是我的程序中没有使用strcat,定位不到错误。