Skip to content

Overridable deleter function for PyTango compatibility (fork)

Mateusz C requested to merge matcelary/cppTango:pytango-545-issue into main

We would like to fix this issue in pytango: pytango#545

that is related to those previous tickets: pytango#190 (closed) https://sourceforge.net/p/tango-cs/bugs/623/

It's a long existing issue with memory management, that Tiago Coutinho tried to solve 13 years ago. In pytango, we create a DeviceClass object and then we pass it to CppTango layer. The problem occurs when we run RestartServer command, because it causes a direct call to delete class_list[i] in cpp. Python and boost is unaware of this so it tries to do the deallocation second time, resulting in segfault.

I propose here using a wrapper deleter function that can be overriden in pytango, so we can manage the memory. The solution was tested with pytango and probably causes no side effects on CppTango. Usage in pytango and more details in this MR: pytango!679

Other solutions can be discussed as mentioned in pytango MR.

Best regards

Edited by Mateusz C

Merge request reports