HomePhabricator
Diffusion MITK a9cc87505757

Workbench crash on simple tree model update.

Description

Workbench crash on simple tree model update.

Reproduction steps followed:
1. Enable the DataStorageViewer Test plugin.
2. Load a data node and create a child node.
3. For child node create a polygon model.
4. Remove parent node then remove child node.
5. Try to remove the last remaining polygon model, Application crashing at this point.

Since after removing the last remaining polygon model, QmitkDataStorageSimpleTreeModel::data(const QModelIndex &index, int role) const
gets called and this function is used and gets called after any kind of updation in tree model and after the last node is removed there
is not any reason to access the dataNode pointer which points to dataNode that are already removed and now it is pointing to null, so
logically it is better to check an if condition that
if (!dataNode)
  return QModelIndex()
It will avoid segfault due to which application was crashing.

Details

Provenance
pankaj-r-zero <prawat@msystechnologies.com>Authored on Sep 13 2023, 12:06 PM
kislinskPushed on Oct 4 2023, 10:24 AM
Parents
rMITKa754b053db12: v2023.04
Branches
Unknown
Tags
Unknown

Event Timeline

pankaj-r-zero <prawat@msystechnologies.com> committed rMITKa9cc87505757: Workbench crash on simple tree model update. (authored by pankaj-r-zero <prawat@msystechnologies.com>).Sep 13 2023, 12:06 PM