Reproducible Slicer crash deleting MarkupsROINodes from subject hierarchy

I get a reproducible Slicer application crash following these steps:

Open Slice (scene is empty)
Run

roiNode1 = slicer.mrmlScene.AddNewNodeByClass("vtkMRMLMarkupsROINode")
roiNode1.SetSize((100, 100, 100))
roiNode2 = slicer.mrmlScene.AddNewNodeByClass("vtkMRMLMarkupsROINode")
roiNode2.SetSize((50, 50, 50))

Select both ROI nodes in the subject hierarchy, right click, and select Delete. After a brief pause, Slicer crashes.

If I don’t set the size I don’t get a crash. If I create the ROIs using the GUI, I don’t get the crash. I’m using Slicer 5.7.0-2024-05-1 on Windows.
Also, if there is only one ROI node, deleting it doesn’t cause a crash, so perhaps it has something to do with iterating over multiple objects to delete. Also, since deleting multiple ROIs which were created via GUI does not cause the crash, I would guess that maybe there is something incompletely initialized about those created via AddNewNodeByClass.

No crash on the same sequence of actions in 5.6.1, so it must be due to a change introduced between 5.6.1 and 5.7.0-2024-05-01

Thanks for reporting! I am working on a fix.

1 Like

Fixed in BUG: Fix crash when deleting multiple markups in subject hierarchy by Sunderlandkyl · Pull Request #7736 · Slicer/Slicer · GitHub.

1 Like