ros/ros_comm

Cannot move rosbag::Bag

Bob-1 opened this issue · 0 comments

Bob-1 commented

rosbag::Bag has a move constructor, which fails for below example:

std::vector<rosbag::Bag> bags;
bags.push_back(rosbag::Bag());

It is the file_ swap that fails, because file_.read_stream_ and file_.write_stream_ are null pointers.

Checks could be added there to make sure these pointers are valid, but that's probably not the right solution. Furthermore, when solving it that way below warning is shown at termination:

Warning: class_loader.ClassLoader: SEVERE WARNING!!!
Attempting to unload /opt/ros/noetic/lib//librosbag_default_encryption_plugins.so
while objects created by this library still exist in the heap!
You should delete your objects before destroying the ClassLoader. The library will NOT be unloaded.
         at line 119 in /tmp/binarydeb/ros-noetic-class-loader-0.5.0/src/class_loader.cpp

When searching for this the only thing I could find is this open question.