搜了一下说是控件关联变量问题,我排查了很久,都没找到到底是那个问题
这里是具体错误地方的代码,1065行也是就是这里的第18行
1 BOOL CWnd::DestroyWindow() 2 { 3 CWnd* pWnd; 4 CHandleMap* pMap; 5 HWND hWndOrig; 6 BOOL bResult; 7 8 if ((m_hWnd == NULL) && (m_pCtrlSite == NULL)) 9 return FALSE; 10 11 bResult = FALSE; 12 pMap = NULL; 13 pWnd = NULL; 14 hWndOrig = NULL; 15 if (m_hWnd != NULL) 16 { 17 pMap = afxMapHWND(); 18 ENSURE(pMap != NULL); 19 pWnd = (CWnd*)pMap->LookupPermanent(m_hWnd); 20 #ifdef _DEBUG 21 hWndOrig = m_hWnd; 22 #endif 23 } 24 25 if ((m_hWnd != NULL) || (m_pCtrlSite != NULL)) 26 { 27 if (m_pCtrlSite == NULL) 28 bResult = ::DestroyWindow(m_hWnd); 29 else 30 bResult = m_pCtrlSite->DestroyControl(); 31 } 32 33 if (hWndOrig != NULL) 34 { 35 // Note that 'this' may have been deleted at this point, 36 // (but only if pWnd != NULL) 37 if (pWnd != NULL) 38 { 39 // Should have been detached by OnNcDestroy 40 #ifdef _DEBUG 41 ASSERT(pMap->LookupPermanent(hWndOrig) == NULL); 42 #endif 43 } 44 else 45 { 46 #ifdef _DEBUG 47 ASSERT(m_hWnd == hWndOrig); 48 #endif 49 // Detach after DestroyWindow called just in case 50 Detach(); 51 } 52 } 53 54 return bResult; 55 }
可能是需要在onDestroy函数里面执行卸载吧,感觉是解决了。没报错了