Skip to content

Commit

Permalink
Check number of scalars in properties panel update
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
psavery committed Mar 10, 2020
1 parent b5899d9 commit fe7fbfd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tomviz/DataPropertiesPanel.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,15 @@ QList<ArrayInfo> DataPropertiesPanel::getArraysInfo(DataSource* dataSource)
{
QList<ArrayInfo> arraysInfo;

// If the number of scalar arrays has changed, reset the indexes.
auto scalars = dataSource->listScalars();
if (scalars.size() != m_scalarIndexes.size())
m_scalarIndexes.clear();

// If we don't have the scalar indexes, we sort the names and then save the
// indexes, these will be used to preserve the displayed order even after
// a rename.
if (m_scalarIndexes.isEmpty()) {
auto scalars = dataSource->listScalars();
auto sortedScalars = scalars;

// sort the scalars names
Expand Down

0 comments on commit fe7fbfd

Please sign in to comment.