Page MenuHomePhabricator

[Storage inspector] Node predicate not used correctly
Closed, ResolvedPublic

Description

As already mentioned in T29331#242461 there is a flaw in the way some data storage models are implemented:
The QmitkAbstractDataStorageModel-class provides a function SetNodePredicate, which calls a (pure virtual) function NodePredicateChanged. Subclasses implementing this function can handle the setting of a node predicate the way they want.
This is for example done inside:

  • QmitkDataStorageSimpleTreeModel::NodePredicateChanged, which calls QmitkDataStorageSimpleTreeModel::UpdateModelData
    • here the local member m_NodePredicate is used to check if a node of the data storage should be included in the model
  • QmitkDataStorageDefaultListModel::NodePredicateChanged, which calls QmitkDataStorageDefaultListModel::UpdateModelData()
    • here the local member m_NodePredicate is used to check if a node of the data storage should be included in the model

The problem is the following:
These NodePredicateChanged / UpdateModelData are not the only functions changing / updating the model data. Typically the data storage models also listen to the AddNodeEvent, RemoveNodeEvent and ChangedNodeEvent of the data storage.

This results in the following functions being called (for example):

  • QmitkDataStorageSimpleTreeModel::NodeAdded, which calls QmitkDataStorageSimpleTreeModel::AddNodeInternal
    • here the given node is added to the tree-structure without being checked by the m_NodePredicate
  • QmitkDataStorageDefaultListModel::NodeAdded instead calls QmitkDataStorageDefaultListModel::UpdateModelData() again, so everything hould be fine (see above)

There is another class, QmitkImageStatisticsTreeModel, which works a bit differently and needs to be checked.

Revisions and Commits

rMITK MITK
Restricted Differential Revision
Restricted Differential Revision