Hello Michael,

it seems as if there is a bug in my contribution (VERY obscure one - took me several days to figure it out). Basically, when several nodes are deleted by the user, selectionChanged() signal is emitted after the first of the nodes is removed. This leads to setting the "selected" property on the other node that is yet to be deleted. This eventually calls NodeChanged() of the data manager view which calls invalidate() on the filter model. Turns out that this call stack, that is filter invalidation /during/ row deletion, screws up the QSortFilterProxyModel's internal state and leads to a crash in a very obscure place within Qt code.

Could you please check this for me? The reproduction steps are really simple. Fire up an empty workbench instance, show hidden nodes and nodes with no data, select widget3Plane and widget2Plane under Widgets, and delete them - this leads to crash in my case.

If it does crash - then I found the following solution to work. To avoid immediate filter invalidation, I postpone it using Qt::QueuedConnection slot invocation. So if you replace the code of NodeChanged() in QmitkDataManagerView
from
m_FilterModel->invalidate();
to
QMetaObject::invokeMethod(m_FilterModel, "invalidate", Qt::QueuedConnection);
then the crash willl be fixed.

Also during my struggles in searching for the causes of this crash, I have found that in QmitkDataManagerView::RemoveSelectedNodes, this->GlobalReinit(false) is called after every node is deleted. I doubt it makes any sense, so I believe it should be moved out of the loop over the nodes being deleted, so that GlobalReinit() is called only once all selected nodes are removed. This should increase the performance.

Rostislav.
------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
mitk-users mailing list
mitk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to