Merge pull request #12042 from MillionOstrich/treeitem-move-to-bottom

Stop move_to_bottom losing references to treeitems
This commit is contained in:
Poommetee Ketson 2017-10-21 04:58:11 +07:00 committed by GitHub
commit ec12e3b4f9

View file

@ -47,18 +47,21 @@ void TreeItem::move_to_top() {
}
void TreeItem::move_to_bottom() {
if (!parent || !next)
return;
while (next) {
TreeItem *prev = get_prev();
TreeItem *last = next;
while (last->next)
last = last->next;
if (parent->childs == this)
if (prev) {
prev->next = next;
} else {
parent->childs = next;
TreeItem *n = next;
next = n->next;
n->next = this;
}
last->next = this;
next = NULL;
}
Size2 TreeItem::Cell::get_icon_size() const {