task Node::destroy
This commit is contained in:
37
src/node.cpp
37
src/node.cpp
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user