Fix tree-view item ignoring custom matches() method override
No user visible change expected (this isn't used in existing code yet). Users of the tree-view API should be able to write their own `matches()` method to compare tree-view elements after tree reconstruction. Part of the tree-view matching process wouldn't use this though, and use the `matches_single()` method instead, causing issues like multiple items sharing the same state. This was initially done for an optimization (the default `matches()` compares parents as well, which seems redundant here), but it backfires and actually isn't needed. The default `matches()` only compares the parents when `matches_single()` returns true anyway, so the redundancy is really minor and not a performance concern.
This commit is contained in:
@@ -108,7 +108,7 @@ AbstractTreeViewItem *AbstractTreeView::find_matching_child(
|
||||
const AbstractTreeViewItem &lookup_item, const TreeViewOrItem &items)
|
||||
{
|
||||
for (const auto &iter_item : items.children_) {
|
||||
if (lookup_item.matches_single(*iter_item)) {
|
||||
if (lookup_item.matches(*iter_item)) {
|
||||
/* We have a matching item! */
|
||||
return iter_item.get();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user