View Issue Details

IDProjectCategoryView StatusLast Update
0004713Slicer4Module SubjectHierarchypublic2019-10-02 13:20
ReporterlassoanAssigned Topinter 
Status resolvedResolutionfixed 
Product VersionSlicer 4.11.0 
Target VersionbacklogFixed in VersionSlicer 4.11.0 
Summary0004713: Subject hierarchy hangs if script sets child item as parent of its parent

It is possible to create invalid hierarchy that makes Slicer hang. For example:

shNode = slicer.vtkMRMLSubjectHierarchyNode.GetSubjectHierarchyNode(slicer.mrmlScene)
sceneItemID = shNode.GetSceneItemID()
mainfolder_ID = shNode.CreateFolderItem(sceneItemID, "Main Folder")
subfolder_ID = shNode.CreateFolderItem(sceneItemID, "Sub Folder")
shNode.SetItemParent(subfolder_ID,mainfolder_ID) # regular hiearchy setting
shNode.SetItemParent(mainfolder_ID, subfolder_ID) ## Makes slicer crash instead of returning an error

It would be better to check if the new parent is not a child of the item and return an error (there could be a flag in SetItemParent to bypass this safety check for performance-critical cases).

See for details.

TagsNo tags attached.


Issue History

Date Modified Username Field Change
2019-10-01 20:57 lassoan New Issue
2019-10-01 20:57 lassoan Status new => assigned
2019-10-01 20:57 lassoan Assigned To => pinter
2019-10-02 13:20 pinter Status assigned => resolved
2019-10-02 13:20 pinter Resolution open => fixed
2019-10-02 13:20 pinter Fixed in Version => Slicer 4.11.0
2019-10-02 13:20 pinter Note Added: 0016290