线程每隔一段时间刷新视图当关闭视图时有时候会出错
///////////线程//////////////
POSITION p1=curTemplate->GetFirstDocPosition();
if (p1!=NULL)
{
CDocument *pDoc=curTemplate->GetNextDoc(p1);
POSITION p2=pDoc->GetFirstViewPosition();
while(p2!=NULL)
{
CView *pView=pDoc->GetNextView(p2);
if (pView->IsKindOf(RUNTIME_CLASS(CXL2101A24UView)))
{
CWnd *pWnd=pView->FromHandle(pView->m_hWnd);
pWnd->SendMessage(WM_BREAKGRAPH,0,0);//发消息刷新视图
}
}
}
/////////////出错///////////////////
BOOL CObject::IsKindOf(const CRuntimeClass* pClass) const
{
ENSURE(this != NULL);
// it better be in valid memory, at least for CObject size
ASSERT(AfxIsValidAddress(this, sizeof(CObject)));
// simple SI case
CRuntimeClass* pClassThis = GetRuntimeClass();///出错
ENSURE(pClassThis);
return pClassThis->IsDerivedFrom(pClass);
}
报0xC0000005:读取位置0xfeeefeee时发生访问冲突