# SlicerCAT breaks down when \`vtkMRMLMarkupsFiducialNode::EndModify()\` is called

**URL:** <https://discourse.slicer.org/t/slicercat-breaks-down-when-vtkmrmlmarkupsfiducialnode-endmodify-is-called/21122>\
**Category:** Development\
**Created:** [December 18, 2021, 3:10am UTC](https://discourse.slicer.org/t/slicercat-breaks-down-when-vtkmrmlmarkupsfiducialnode-endmodify-is-called/21122 "2021-12-18T03:10:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![keri](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/keri/32/11618_2.png) [@keri](https://discourse.slicer.org/u/keri)\
**Post date:** [December 18, 2021, 3:10am UTC](https://discourse.slicer.org/t/slicercat-breaks-down-when-vtkmrmlmarkupsfiducialnode-endmodify-is-called/21122/1 "2021-12-18T03:10:49Z")

</div>

Hi,

Via GUI interface I add control points to `vtkMRMLMarkupsFiducialNode` one by one.  
I’m able to add the first control point but when I’m trying to add second control point SlicerCAT falls down on the line `fiducialNode->EndModify(wasModified);`

The code that I use is below and the output to console that I get will be a little bit lower:

```auto
  // fiducialNode has type `vtkMRMLMarkupsFiducialNode`
  int wasModified = fiducialNode->StartModify();
  std::cout << "START MODIFY: " << wasModified << std::endl;

  int id = fiducialNode->AddFiducial(1,2,3,"my name");
  std::cout << "fiducial id: " << id << std::endl;

  fiducialNode->SetNthControlPointDescription(
        id, "my description");
  std::cout << "description is set" << std::endl;

  fiducialNode->EndModify(wasModified);
  std::cout << "END MODIFY" << std::endl; // when I add the second point to the `fiducialNode` this line is not shown and SlicerCAT breaks down

```

The output:

```auto
START MODIFY: 0
fiducial id: 0
description is set
END MODIFY
START MODIFY: 0
fiducial id: 1
description is set

```

I noticed that the the app falls because of line code `int wasModified = Superclass::EndModify(previousDisableModifiedEventState);` within `vtkMRMLMarkupsNode::EndModify(int previousDisableModifiedEventState)` function.

I don’t know yet how `StartModify()/EndModify()` works so I’m not sure whether the error is caused by my own code or native Slicer core. But if somebody have some ideas I would appreciate.

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [December 18, 2021, 3:43am UTC](https://discourse.slicer.org/t/slicercat-breaks-down-when-vtkmrmlmarkupsfiducialnode-endmodify-is-called/21122/2 "2021-12-18T03:43:59Z")

</div>

To ensure your question can be answer, could you indicate which version of Slicer is associated with custom application ?

---

<div class="post-metadata">

**Author:** ![keri](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/keri/32/11618_2.png) [@keri](https://discourse.slicer.org/u/keri)\
**Post date:** [December 18, 2021, 9:23am UTC](https://discourse.slicer.org/t/slicercat-breaks-down-when-vtkmrmlmarkupsfiducialnode-endmodify-is-called/21122/3 "2021-12-18T09:23:22Z")

</div>

Yes, the one under `c72d890515ccca70e4173dfcedd370e197c44ae9` git tag

---

<div class="post-metadata">

**Author:** ![keri](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/keri/32/11618_2.png) [@keri](https://discourse.slicer.org/u/keri)\
**Post date:** [December 18, 2021, 5:59pm UTC](https://discourse.slicer.org/t/slicercat-breaks-down-when-vtkmrmlmarkupsfiducialnode-endmodify-is-called/21122/4 "2021-12-18T17:59:12Z")

</div>

I just found the bug in my custom code.  
So this is not a Slicer issue.
