From 4cc2762ebc73c7c52218a88ba5eebb9d90a8afb1 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 14 Dec 2017 23:25:09 +0100 Subject: [PATCH] Don't call wxDataViewModel::GetValue() for container row cells This could be unexpected as it seems reasonable that the model won't be ever asked about the value of a cell if it's not going to appear in it anyhow -- however it could still happen during the column width computation in the generic wxDataViewCtrl implementation. Fix this in a minimally invasive way by just skipping the call to GetValue() in this case. --- src/common/datavcmn.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/common/datavcmn.cpp b/src/common/datavcmn.cpp index 4dbd083d94..8e05377d40 100644 --- a/src/common/datavcmn.cpp +++ b/src/common/datavcmn.cpp @@ -801,7 +801,11 @@ wxDataViewRendererBase::CheckedGetValue(const wxDataViewModel* model, unsigned column) const { wxVariant value; - model->GetValue(value, item, column); + // Avoid calling GetValue() if the model isn't supposed to have any values + // in this cell (e.g. a non-first column of a container item), this could + // be unexpected. + if ( model->HasValue(item, column) ) + model->GetValue(value, item, column); // We always allow the cell to be null, regardless of the renderer type. if ( !value.IsNull() )