From 8aefedcb456c32fac72a691001eb47f23447f559 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 8 May 2022 18:24:01 +0200 Subject: [PATCH] Remove duplicated HasValue() call from wxGTK wxDataViewCtrl code HasValue() is already called by PrepareForItem(), so there is no need to call it explicitly from wxGTK code, just rely on PrepareForItem() returning false if there is no value to show -- we can skip the call to GtkSetCurrentItem() in this case, this function is cheap, and we lose more by calling HasValue() twice in the common case than we save on not calling it. No real changes. --- src/gtk/dataview.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/gtk/dataview.cpp b/src/gtk/dataview.cpp index 5b3b391c98..115299de13 100644 --- a/src/gtk/dataview.cpp +++ b/src/gtk/dataview.cpp @@ -3225,13 +3225,10 @@ static void wxGtkTreeCellDataFunc( GtkTreeViewColumn *WXUNUSED(column), wxDataViewModel *wx_model = tree_model->internal->GetDataViewModel(); - gboolean visible = wx_model->HasValue(item, column); - if ( visible ) - { - cell->GtkSetCurrentItem(item); + cell->GtkSetCurrentItem(item); - visible = cell->PrepareForItem(wx_model, item, column); - } + // Cells without values shouldn't be rendered at all. + const bool visible = cell->PrepareForItem(wx_model, item, column); wxGtkValue gvalue( G_TYPE_BOOLEAN ); g_value_set_boolean( gvalue, visible );