Skip to content

Commit fe7fbfd

Browse files
committed
Check number of scalars in properties panel update
When live updates are performed on data that contains multiple scalars, the number of scalars can change in between updates. Add in a safety check in the DataPropertiesPanel to account for this. This prevents a crash. Signed-off-by: Patrick Avery <patrick.avery@kitware.com>
1 parent b5899d9 commit fe7fbfd

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

tomviz/DataPropertiesPanel.cxx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,11 +181,15 @@ QList<ArrayInfo> DataPropertiesPanel::getArraysInfo(DataSource* dataSource)
181181
{
182182
QList<ArrayInfo> arraysInfo;
183183

184+
// If the number of scalar arrays has changed, reset the indexes.
185+
auto scalars = dataSource->listScalars();
186+
if (scalars.size() != m_scalarIndexes.size())
187+
m_scalarIndexes.clear();
188+
184189
// If we don't have the scalar indexes, we sort the names and then save the
185190
// indexes, these will be used to preserve the displayed order even after
186191
// a rename.
187192
if (m_scalarIndexes.isEmpty()) {
188-
auto scalars = dataSource->listScalars();
189193
auto sortedScalars = scalars;
190194

191195
// sort the scalars names

0 commit comments

Comments
 (0)