Open traversaro opened 1 month ago
Thanks for spotting it, what do you think is the correct solution?
That is kind of a tricky one, as any kind of global state is always tricky to handle. Perhaps we could have an option to enable/disable setting this global state? It may be even more clean to have a dedicated device that only set the logger and the clock, but that would be a bit cumbersome as you would need to remember to insert it in any yarprobotinterface, while the option may be more easy to handle?
See https://github.com/ami-iit/bipedal-locomotion-framework/blob/4ea37800355531fe4c78f12a4ed0aa426a748ed3/devices/YarpRobotLoggerDevice/src/YarpRobotLoggerDevice.cpp#L111-L123 .
This works fine if the device is launched as part of a standalone
yarprobotinterface
process, but if this is done as part of a robotinterface instance created with thelibYARP_robotinterface
, what can happen is that the YARP libraries are unloaded, but the factories are never restored to the non-YARP ones, resulting in segmentation fault if the textlogging or clock functions are used.