DUILIB UIDesigner.exe 多个控件布局的时候 总是会crash
在使用UIDesigner.exe 多个控件布局总是出错。发现代码crash在
void CMultiUITracker::ExcludeChildren(CArray<CControlUI*,CControlUI*>& arrSelected)
函数中,修改后正常。
void CMultiUITracker::ExcludeChildren(CArray<CControlUI*,CControlUI*>& arrSelected)
函数中,修改后正常。
void CMultiUITracker::ExcludeChildren(CArray<CControlUI*,CControlUI*>& arrSelected) { int size = arrSelected.GetSize(); int* pDepth = new int[size]; for(int i=0; i<size; i++) { ExtendedAttributes* pExtended = (ExtendedAttributes*)arrSelected[i]->GetTag(); pDepth[i] = pExtended->nDepth; } for(int i=0; i<arrSelected.GetSize()-1; i++) { CControlUI* pControl1 = arrSelected[i]; for(int j=i+1; j<arrSelected.GetSize(); j++) { if(pDepth[i] != pDepth[j]) { CControlUI* pControl2 = arrSelected[j]; if (pControl2) { if (pDepth[i] < pDepth[j]) { int depth = pDepth[j] - pDepth[i]; while (depth--) { CControlUI* tmp = pControl2->GetParent(); if (tmp) { pControl2 = tmp; } else { break; } } if (pControl1 == pControl2) { arrSelected.RemoveAt(j--); } } else { int depth = pDepth[i] - pDepth[j]; while (depth--) { CControlUI* tmp = pControl1->GetParent(); if (tmp) { pControl1 = tmp; } else { break; } } if (pControl1 == pControl2) { arrSelected.RemoveAt(i--); } } } } } } delete[] pDepth; }