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.
This commit is contained in:
Vadim Zeitlin 2017-12-14 23:25:09 +01:00
parent 2f2ecfa03f
commit 4cc2762ebc

View File

@ -801,6 +801,10 @@ wxDataViewRendererBase::CheckedGetValue(const wxDataViewModel* model,
unsigned column) const
{
wxVariant value;
// 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.