humanoid-path-planner / hpp-corbaserver

Corba server for Humanoid Path Planner applications
BSD 2-Clause "Simplified" License
4 stars 20 forks source link

avoid throwing an exception with deleting twice a servant. #196

Closed jmirabel closed 1 year ago

jmirabel commented 1 year ago

When an Python CORBA object is wrap_delete twice, after one of the two is deleted by Python, the corresponding servant in C++ gets deleted. When the second is deleted, an exception is raised. Sadly, at the moment, in Python, it is not possible to count the number of reference to a C++ servant so it is hard to avoid such situation.

This PR bypasses the issue by not raising an error when trying to delete an already deleted object. This should be safe since there is semantically no work to do to delete an already deleted object.

Another possible solution is to catch the exception in the _Deleter class in Python.