Skip to content

Commit

Permalink
Update UIWindow.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
xrSimpodin committed Feb 9, 2019
1 parent 62b4b62 commit 2dcae9e
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions ogsr_engine/xrGame/ui/UIWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,12 +256,19 @@ void CUIWindow::DetachChild(CUIWindow* pChild, bool from_destructor)
if( GetMouseCapturer() == pChild )
SetMouseCapture(pChild, false);

try {
m_ChildWndList.remove(pChild);
}
catch(...)
auto it = std::find(m_ChildWndList.begin(), m_ChildWndList.end(), pChild);
if (it != m_ChildWndList.end())
{
ASSERT_FMT(std::find(m_ChildWndList.begin(), m_ChildWndList.end(), pChild) == m_ChildWndList.end(), "Can't remove pointer [%x] from m_ChildWndList", pChild);
// KRodin: я знаю, что этот костыль ужасен.
auto to_delete = new decltype(m_ChildWndList)();
to_delete->splice(to_delete->begin(), m_ChildWndList, it);
//ASSERT_FMT(std::find(m_ChildWndList.begin(), m_ChildWndList.end(), pChild) == m_ChildWndList.end(), "Can't remove pointer [%x] from m_ChildWndList", pChild);
//ASSERT_FMT(std::find(to_delete->begin(), to_delete->end(), pChild) != to_delete->end(), "Can't remove pointer [%x] from m_ChildWndList (2)", pChild);
//ASSERT_FMT(to_delete->size() == 1, "");
try {
delete to_delete;
}
catch (...) {}
}

pChild->SetParent(NULL);
Expand Down

0 comments on commit 2dcae9e

Please sign in to comment.