diff --git a/slsDetectorServers/slsDetectorServer_cpp/include/DetectorServer.h b/slsDetectorServers/slsDetectorServer_cpp/include/DetectorServer.h index 2fb5f171a..5b5ae7759 100644 --- a/slsDetectorServers/slsDetectorServer_cpp/include/DetectorServer.h +++ b/slsDetectorServers/slsDetectorServer_cpp/include/DetectorServer.h @@ -70,6 +70,8 @@ template class DetectorServer { */ explicit DetectorServer(uint16_t port = DEFAULT_TCP_CNTRL_PORTNO); + ~DetectorServer(); + protected: /// @brief TCP/IP interface for communication with the client std::unique_ptr tcpInterface; @@ -147,6 +149,11 @@ DetectorServer::DetectorServer(uint16_t port) { tcpInterface = std::make_unique(fn, port); } +template +DetectorServer::~DetectorServer() { + shm.removeSharedMemory(); +} + template ReturnCode DetectorServer::processFunction( const detFuncs function_id, ServerInterface &socket) { diff --git a/slsDetectorSoftware/src/SharedMemory.h b/slsDetectorSoftware/src/SharedMemory.h index fa20fd355..4252de9e5 100644 --- a/slsDetectorSoftware/src/SharedMemory.h +++ b/slsDetectorSoftware/src/SharedMemory.h @@ -92,7 +92,7 @@ template class SharedMemory { ~SharedMemory() { if (shared_struct) - unmapSharedMemory(); + unmapSharedMemory(); // only unmapped as resued in command line } /** memory is valid if it has the IsValid flag and is true */