From 1d4fac0cda9bfde2de51d31c84fc9fcfdbedde56 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Fri, 16 Jun 2023 12:28:02 +0200 Subject: [PATCH] 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. --- source/blender/editors/interface/views/tree_view.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/editors/interface/views/tree_view.cc b/source/blender/editors/interface/views/tree_view.cc index 52e11288514..8d6347de24d 100644 --- a/source/blender/editors/interface/views/tree_view.cc +++ b/source/blender/editors/interface/views/tree_view.cc @@ -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(); }