Skip to content

Commit

Permalink
Фикс вылета в DoDetachChild
Browse files Browse the repository at this point in the history
  • Loading branch information
joye-ramone authored and xrSimpodin committed Jun 9, 2024
1 parent f530eed commit 69a55dc
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions ogsr_engine/xrGame/ui/UITreeViewItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,16 +195,15 @@ void CUITreeViewItem::AddItem(CUITreeViewItem* pItem)

//////////////////////////////////////////////////////////////////////////

// вызывается из деструктора
void CUITreeViewItem::DeleteAllSubItems()
{
for (SubItems_it it = vSubItems.begin(); it != vSubItems.end(); ++it)
for (auto* vSubItem : vSubItems)
{
CUIWindow* pWindow = (*it)->GetParent();

if (pWindow)
pWindow->DetachChild(*it);

xr_delete(*it);
if (!vSubItem->GetParent()) // удалям явно только если у саб айтема нету родителя, иначе он будет удален самим родителем
{
xr_delete(vSubItem);
}
}

vSubItems.clear();
Expand Down

0 comments on commit 69a55dc

Please sign in to comment.