From faffc5fe0a6deb21f6f35cfe252d9cf43f63fbf6 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 5 Dec 2020 14:16:17 +0100 Subject: [PATCH] Only invalidate row height cache when a row is really expanded It's wasteful to do it if it's already expanded or won't be expanded because the EXPANDING event is vetoed. --- src/generic/datavgen.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp index 2dfd7a953c..4b3ae669ec 100644 --- a/src/generic/datavgen.cpp +++ b/src/generic/datavgen.cpp @@ -3919,13 +3919,6 @@ void wxDataViewMainWindow::Expand( unsigned int row ) if (!node->HasChildren()) return; - if ( m_rowHeightCache ) - { - // Expand makes new rows visible thus we invalidates all following - // rows in the height cache - m_rowHeightCache->Remove(row); - } - if (!node->IsOpen()) { if ( !SendExpanderEvent(wxEVT_DATAVIEW_ITEM_EXPANDING, node->GetItem()) ) @@ -3934,6 +3927,13 @@ void wxDataViewMainWindow::Expand( unsigned int row ) return; } + if ( m_rowHeightCache ) + { + // Expand makes new rows visible thus we invalidates all following + // rows in the height cache + m_rowHeightCache->Remove(row); + } + node->ToggleOpen(this); // build the children of current node