Problems with certain buttons in the edited segment of a custom slicer!!!!!

Hello. I am Giorgio, a biomedical engineering student in Verona, and I am working with 3D Slicer for an internship.

My task is to create a custom Slicer application. I am trying to integrate the Segment Editor window into my interface, but I am running into issues. The custom application crashes whenever I try to use the Paint, Erase, or Smoothing buttons.

How can I fix this problem?