|
It's my fault. I didn't make it clear. The TRACE in OnGetData() has been executed. After this TRACE is executed, in theory, the TRACE after WaitForSingleObject() should be executed again. But no, the program debug jumps out of an assert. The call stack is as follows:
CMapPtrToPtr::GetValueAt(void * 0x002602de) line 186 + 9 bytes
CHandleMap::LookupPermanent(void * 0x002602de) line 90 + 19 bytes
CWnd::AssertValid() line 894 + 15 bytes
CView::AssertValid() line 495
CFormView::AssertValid() line 278
CEcmRecordView::AssertValid() line 62
AfxAssertValidObject(const CObject * 0x003d63a0 {CEcmRecordView}, const char
* 0x5f4d1700 THIS_FILE, int 939) line 108
CDocument::AssertValid() line 940
CEcmUIDoc::AssertValid() line 109
AfxAssertValidObject(const CObject * 0x003d5d88 {CEcmUIDoc}, const char * 0x
5f4d1744 THIS_FILE, int 425) line 108
CDocTemplate::AssertValid() line 426
CMultiDocTemplate::AssertValid() line 220
AfxAssertValidObject(const CObject * 0x003d4a38 {CMultiDocTemplate}, const c
har * 0x5f4d17e0 THIS_FILE, int 852) line 108
CDocManager::AssertValid() line 853
AfxAssertValidObject(const CObject * 0x003d4b98 {CDocManager}, const char *
0x5f4d1a38 THIS_FILE, int 551) line 108
CWinApp::AssertValid() line 552
AfxAssertValidObject(const CObject * 0x00424978 class CEcmUIApp theApp, cons
t char * 0x5f4d19e8 THIS_FILE, int 537) line 108
CWinThread::OnIdle(long 0) line 541
CWinApp::OnIdle(long 0) line 479
CWinThread::Run() line 479 + 30 bytes
CWinApp::Run() line 400
AfxWinMain(HINSTANCE__ * 0x00400000, HINSTANCE__ * 0x00000000, char * 0x0014
1efa, int 1) line 49 + 11 bytes
WinMain(HINSTANCE__ * 0x00400000, HINSTANCE__ * 0x00000000, char * 0x00141ef
a, int 1) line 30
WinMainCRTStartup() line 330 + 54 bytes
KERNEL32! 7c816fd7()
The above is the prompt in the call stack, the following is the code of CMapPtrToPtr() and the place of error:
void* CMapPtrToPtr::GetValueAt(void* key) const
// find value (or return NULL - NULL values not different as a result)
{
if (m_pHashTable == NULL)
return NULL;
UINT nHash = HashKey(key)% m_nHashTableSize;
// see if it exists
CAssoc* pAssoc;
for (pAssoc = m_pHashTable[nHash]; pAssoc != NULL; pAssoc = pAssoc->pNext)
// assert here
{
if (pAssoc->key == key)
return pAssoc->value;
}
return NULL;
}
Thank you all for your attention, help me think about it and brainstorm |
|