Skip to content
  • Mateusz C's avatar
    introduce overwritable delete DeviceClass* function for pytango · 57e28223
    Mateusz C authored
    This change is not intended to change CppTango behaviour, but to allow PyTango to manage the memory better, by overwriting
    a deleter utility function. Previously when a DeviceClass object was created in python layer and it was passed to Cpp,
    if 'delete class_list[i]' was invoked, python had no chance of knowing this, so when it attempted garbage collection,
    it would try to deallocate memory second time causing SEGFAULT.
    
    Global function pointer was suggested for those reasons:
    - overloading DServer methods is not possible in this case in pytango, because our DServer object is allocated in cpp layer
    (oblivious of any pytango overwrites) in 'dserverclass.cpp' file in 'DServerClass::device_factory' method
    - in future we could need this for some other parts of the system if similar pytango error occurs
    - it allows to define the value of the wrapper_compatible_delete pointer outside of the methods
    57e28223