task Node::destroy

This commit is contained in:
2019-08-31 17:20:09 +02:00
parent ceac62aecb
commit ef2210b57c

View File

@@ -58,22 +58,27 @@ void Node::watch(std::function<bool(Node*)> observer)
void Node::destroy()
{
m_destroyed = true;
mouse_release();
key_release();
for (auto& c : m_children)
c->destroy();
for (auto p = m_parent; p; p = p->m_parent)
if (p->child_mouse_focus.get() == this)
p->child_mouse_focus = nullptr;
//App::I->ui_task([&]
//{
// auto cp = m_children;
// for (auto& c : cp)
// c->destroy();
// remove_all_children();
// remove_from_parent();
//});
//m_destroyed = true;
//mouse_release();
//key_release();
//for (auto& c : m_children)
// c->destroy();
//for (auto p = m_parent; p; p = p->m_parent)
// if (p->child_mouse_focus.get() == this)
// p->child_mouse_focus = nullptr;
App::I->ui_task([&]
{
mouse_release();
key_release();
auto cp = m_children;
for (auto& c : cp)
c->destroy();
for (auto p = m_parent; p; p = p->m_parent)
if (p->child_mouse_focus.get() == this)
p->child_mouse_focus = nullptr;
remove_all_children();
remove_from_parent();
});
}
Node* Node::root()