- Load an image and create a segmentation
- Uncheck "Show position nodes" for the 3D interpolation
-> Crash
-> Crash
C:\home\graser\BugSquashing\MITK\CoreUI\Qmitk\QmitkDataStorageTreeModel.cpp
line 479:
In the Function
void QmitkDataStorageTreeModel::RemoveNode( const mitk::DataNode* node )
Andreas added the lines
"
bool isHelperObject (false); NodeTagMapType::iterator searchIter = m_HelperObjectObserverTags.find( const_cast<mitk::DataNode*>(node) ); if (node->GetBoolProperty("helper object", isHelperObject) && searchIter != m_HelperObjectObserverTags.end()) { (*searchIter).first->GetProperty("helper object")->RemoveObserver( (*searchIter).second ); m_HelperObjectObserverTags.erase(const_cast<mitk::DataNode*>(node)); }
"
When you comment these lines, it works again.
Not quite sure, what these lines are exactly for and where they should put.
Andreas will have a look
The intention for adding this code was to remove the observer from a node if it was deleted. Since all observers are removed in QmitkDataStorageTreeModel's destructor removing a node an then closing the application leads to a crash.
Unfortunately the QmitkDataStorageTreeModel uses the RemoveNode method in two different scenarios:
I now deleted all code which removes this observer an it works fine. It seem that deleting a DataNode from the DataManager already removes its observer.
Ok I tried the other better solution and it works :-)
+ Adapted the ChangeRequest
All observers are now removed correctly
[2f6475]: Merge branch 'bug-10877-segmentation-crash-when-unchecking-showPositio
2012-02-03 13:56:55 Andreas Fetzer [5cb7e9]
QmitkDataStorageTreeModel now has two internal Add/Remove functions to update itself
The external accessible AddNode/RemoveNode function now registers/unregisters
possible existing observers. Afterwards the internal ones are called to update the treemodel.
The treemodel itself just calls the internal ones if the datamanager's preferences have
changed or the helper object property's value has has changed.
All oberserver are now unregistered/removed correctly
2012-02-02 15:31:33 Andreas Fetzer [45a4d5]
Removed the code that removes the helper object property observers from the nodes.