From 3e6d9b56a3bd63e656ad2c0990e5595815afd94c Mon Sep 17 00:00:00 2001 From: Alice Date: Tue, 26 May 2026 15:14:38 +0200 Subject: [PATCH] removed shared memory in destructor --- .../slsDetectorServer_cpp/include/DetectorServer.h | 7 +++++++ slsDetectorSoftware/src/SharedMemory.h | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) 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 */