How to handle sensitive detector on UI geometry change

Hello,

I am having trouble resolving an error/warning, related to the sensitive detector, I get when I redefine my detector geometry via UI commands. The redefinition involves a volume change, so as far as I can tell, I have to delete and re-instantiate the logical volume. If I don’t delete the attached sensitive detector (even after using ->Activate("/Detector",false):wink: I get the following warning:

-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : DET1010
issued by : G4SDStructure::AddNewDetector()
Cathode had already been stored in /. Object pointer is overwitten.
It’s users’ responsibility to delete the old sensitive detector object.
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------

However, if I try and delete the sensitive detector object, the simulation crashes on exit when the run manager is deleted.

I looked at the documentation but couldn’t find any information there on the proper handling of sensitive detectors in this case. It seems wrong to me to just produce a dangling object in memory and not properly delete it.

Any help is appreciated.

Thanks,

Michael