fix crash that could occur when clearing treebox

This commit is contained in:
Jinhao
2017-02-19 13:11:13 +08:00
parent 5d3f565ce1
commit c1113cf41d
3 changed files with 91 additions and 52 deletions

View File

@@ -58,6 +58,31 @@ namespace detail
t = t_next;
}
}
bool is_ancestor_of(const tree_node* child) const
{
while (child)
{
if (child->owner == this)
return true;
child = child->owner;
}
return false;
}
tree_node * front() const
{
if (this->owner && (this != this->owner->child))
{
auto i = this->owner->child;
while (i->next != this)
i = i->next;
return i;
}
return nullptr;
}
};
template<typename UserData>

View File

@@ -119,7 +119,6 @@ namespace nana
implement * impl() const;
void check(node_type*, checkstate);
bool draw();
const tree_cont_type & tree() const;
tree_cont_type & tree();