Sensitive Detectors and Segmentation Fault

Hi all!
I’m trying to add a sensitive detector (SD) to my simulation to record particles’ positions. I used an example that I found on the internet. The visualization works fine, but when running the simulation, there is a *** Break *** segmentation violation just when my particle hits the SD.

here is some fragment of my output:

14     -8.1   -0.288      452  6.12e+03        0      0.1       152       World Transportation
   15    -8.42  -0.0442      495  6.12e+03   0.0157     43.5       195        SD Transportation
   16    -8.46  -0.0103      501  6.11e+03      4.3     6.01       201        SD hIoni
SENSITIVE TrackID: 1 PID: proton EnDep: 4.299441771919492 MeV Position: -0.8417134997642908 -0.004418171660045741 49.5 cm 

 *** Break *** segmentation violation



===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================

Thread 5 (Thread 0x7fc69d450700 (LWP 26194)):
#0  futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x562105361848) at ../sysdeps/nptl/futex-internal.h:183
#1  __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x5621053617f8, cond=0x562105361820) at pthread_cond_wait.c:508
#2  __pthread_cond_wait (cond=0x562105361820, mutex=0x5621053617f8) at pthread_cond_wait.c:638
#3  0x00007fc6a3a2e62b in ?? () from /usr/lib/x86_64-linux-gnu/dri/nouveau_dri.so
#4  0x00007fc6a3a2e23b in ?? () from /usr/lib/x86_64-linux-gnu/dri/nouveau_dri.so
#5  0x00007fc6b780f609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#6  0x00007fc6b7d73293 in clone () from /usr/lib/x86_64-linux-gnu/libc.so.6´

error.txt (8.0 KB)

And this is a fragment of how i defined my SD

G4LogicalVolume *SDL = new G4LogicalVolume(SD,tmpMaterial,Form("%sLV",name.c_str()),0,0,0);
  logicVolumes.push_back(SDL);
  SDL->SetVisAttributes(sensorVisAtt);

    auto sensor = new MySensorDetector("SiPM");  
    SDL->SetSensitiveDetector(sensor);

If I comment the latter two lines (auto sensor... , SDL ->), the code works fine but my sensor detector becomes just a simple box… I would appreciate a hint of a possible error since I already check some of the related posts here, but they weren’t useful for me.

Thanks in advanced for your time.
Yael