Electron 1.2, segmentation fault with c++ addon



I am testing a c++ addon (this addon loads a dynamic library with dlopen) with electron and I have got segmentation fault only when app exits.This segmentation faul does not occur when I execute this applicacion from command line (“electron .”), but if I execute this application from executable version (I use electron builder package) I get this fault:

#0  __pthread_mutex_trylock (mutex=0x0) at ../nptl/pthread_mutex_trylock.c:43
#1  0x00007fffcf87e30a in NativeLockMutex(void*) () from /usr/lib/libpkcs11-dnie.so
#2  0x00007fffcf872322 in C_Logout () from /usr/lib/libpkcs11-dnie.so
#3  0x00007fffe46e446c in ?? () from /home/osboxes/Proyectos/tractis/tr-hq-pkiclient/dist/dist/linux/resources/app.asar.unpacked/dyn/libsbb.so
#4  0x00007fffe2e563c0 in ?? ()
#5  0x0000000000000001 in ?? ()
#6  0x0000000000000000 in ?? ()

libsbb.so is an external library that loads /usr/lib/libpkcs11-dnie.so with dlopen. I guess there is something wrong when electron invoke C++ destructor, but I can’t debug this both dynamic libraries (I can’t get debug versions of them). Do you know why I get this segmentation fault only with executable version of the app?