# Reproducible Slicer crash deleting MarkupsROINodes from subject hierarchy

**URL:** <https://discourse.slicer.org/t/reproducible-slicer-crash-deleting-markupsroinodes-from-subject-hierarchy/36007>\
**Category:** Support\
**Tags:** bug\
**Created:** [May 8, 2024, 9:15pm UTC](https://discourse.slicer.org/t/reproducible-slicer-crash-deleting-markupsroinodes-from-subject-hierarchy/36007 "2024-05-08T21:15:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikebind](https://avatars.discourse-cdn.com/v4/letter/m/71e660/32.png) [@mikebind](https://discourse.slicer.org/u/mikebind)\
**Post date:** [May 8, 2024, 9:15pm UTC](https://discourse.slicer.org/t/reproducible-slicer-crash-deleting-markupsroinodes-from-subject-hierarchy/36007/1 "2024-05-08T21:15:10Z")

</div>

I get a reproducible Slicer application crash following these steps:

Open Slice (scene is empty)  
Run

```auto
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.

---

<div class="post-metadata">

**Author:** ![mikebind](https://avatars.discourse-cdn.com/v4/letter/m/71e660/32.png) [@mikebind](https://discourse.slicer.org/u/mikebind)\
**Post date:** [May 8, 2024, 10:37pm UTC](https://discourse.slicer.org/t/reproducible-slicer-crash-deleting-markupsroinodes-from-subject-hierarchy/36007/2 "2024-05-08T22:37:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Sunderlandkyl](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/sunderlandkyl/32/79987_2.png) [@Sunderlandkyl](https://discourse.slicer.org/u/Sunderlandkyl)\
**Post date:** [May 9, 2024, 1:19pm UTC](https://discourse.slicer.org/t/reproducible-slicer-crash-deleting-markupsroinodes-from-subject-hierarchy/36007/3 "2024-05-09T13:19:36Z")

</div>

Thanks for reporting! I am working on a fix.

---

<div class="post-metadata">

**Author:** ![Sunderlandkyl](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/sunderlandkyl/32/79987_2.png) [@Sunderlandkyl](https://discourse.slicer.org/u/Sunderlandkyl)\
**Post date:** [May 10, 2024, 1:36pm UTC](https://discourse.slicer.org/t/reproducible-slicer-crash-deleting-markupsroinodes-from-subject-hierarchy/36007/4 "2024-05-10T13:36:02Z")

</div>

Fixed in [BUG: Fix crash when deleting multiple markups in subject hierarchy by Sunderlandkyl · Pull Request #7736 · Slicer/Slicer · GitHub](https://github.com/Slicer/Slicer/pull/7736).
