Hi there again,

Just for the sake of clarity: The TreeItem class has one central idea, that is 
to map the DataStorage's cyclic graph data structure into a tree structure. We 
wanted to have a tree view for the DataManager because we thought it is more 
user friendly than any view to navigate a graph and the use cases are rare in 
which a DataNode needs to have more than one parent.
Anyway, this mapping could be also packed in a QStandardItemModel-derived class 
and we are certainly interested.
For the upcoming release I will nevertheless merge the code that is necessary 
to resolve the issue you reported in the previous mail below.

Best
Michael

Von: Rostislav Khlebnikov [mailto:rostislav.khlebni...@kcl.ac.uk]
Gesendet: Dienstag, 2. September 2014 17:08
An: Müller, Michael
Cc: mitk-users
Betreff: Re: [mitk-users] QSortFilterProxyModel bugfix and node deletion 
performance

Additionally, seems a similar bug was reported in Qt quite a while ago, but no 
action was taken because the bug reporter didn't provide enough information: 
https://bugreports.qt-project.org/browse/QTBUG-27289
And also, while searching for the reason for crash, I made a test where I 
basically replaced the base class for QmitkDataStorageTreeModel from 
QAbstractItemModel to QStandardItemModel, thus removing the custom tree 
hierarchy code (everything related to QmitkDataStorageTreeModel::TreeItem). I 
don't really see any advantages in having this own tree hierarchy and I believe 
that re-using Qt code will always be more robust and clean than having it 
basically duplicated in MITK. Would you be interested in these changes?

Rostislav.
On 02/09/2014 14:36, Rostislav Khlebnikov wrote:
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<mailto:mitk-users@lists.sourceforge.net>

https://lists.sourceforge.net/lists/listinfo/mitk-users

------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
mitk-users mailing list
mitk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to