-
Notifications
You must be signed in to change notification settings - Fork 249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace poco dependency by rcutils #322
Conversation
Have you properly linked
|
@piraka9011 the PR is not merged yet ros2/rcutils#215 |
rosbag2_converter_default_plugins/src/rosbag2_converter_default_plugins/cdr/cdr_converter.cpp
Outdated
Show resolved
Hide resolved
rosbag2_converter_default_plugins/src/rosbag2_converter_default_plugins/cdr/cdr_converter.cpp
Outdated
Show resolved
Hide resolved
rosbag2_converter_default_plugins/src/rosbag2_converter_default_plugins/cdr/cdr_converter.cpp
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a few comments. I would like to refactor the library initialization into its own function to avoid code duplication.
rosbag2_converter_default_plugins/src/rosbag2_converter_default_plugins/cdr/cdr_converter.cpp
Outdated
Show resolved
Hide resolved
rosbag2_converter_default_plugins/src/rosbag2_converter_default_plugins/cdr/cdr_converter.cpp
Outdated
Show resolved
Hide resolved
Signed-off-by: ahcorde <ahcorde@gmail.com>
I have created an abstraction in rcpputils for rcutils shared library in this branch and I made the changes in rosbag2 here. There is no leak with this solution. @emersonknapp @piraka9011 @Karsten1987 @wjwwood Can you have a look? Maybe we can decline this PR and I can open these two others which is more modern C++ oriented. |
Took a quick look through it - over all i like that approach, I think it's a useful abstraction to have for C++. My personal vote is yes, we should split this out into these two PRs |
rosbag2_converter_default_plugins/src/rosbag2_converter_default_plugins/cdr/cdr_converter.cpp
Outdated
Show resolved
Hide resolved
@ahcorde can you make ahcorde/rcpputils@efc9963 into a pull request? I have some comments but it's better if it is a pull request first. |
d2cdcc3
to
6335d3f
Compare
Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
rcpputils PR is merged, can you review this ? @emersonknapp @piraka9011 @Karsten1987 |
throw std::runtime_error( | ||
std::string("poco exception: library could not be found:") + library_path); | ||
} catch (std::bad_alloc &) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why catch and just let it throw?
This looks much cleaner than before, thanks @ahcorde 👍 |
Signed-off-by: ahcorde <ahcorde@gmail.com>
Warnings in Windows are in
|
Feel free to merge it |
@ahcorde please make sure to identify the author of the causing change and notify them on that PR. |
rant on I haven't paid enough attention while reviewing this PR, but I think it's really bad practice to pass in a shared_pointer by reference ( The reason why it fails in the end is that the same pointer is being passed in to load multiple typesupports, which are stored in We definitely have to come up with better tests for the converter. |
So, I know there's some kind of taboo in our team about shared pointers and references, but what you describe is exactly what the CppCoreGuidelines suggest you do if you might "reseat" (their term meaning point it to a different object) the shared pointer: https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rr-sharedptrparam |
fair enough. I take that argument when you transfer ownership. I still think though that in this case it's not necessarily applied correctly. The current The moment you call the current implementation, you have to be aware that not only will the shared pointer you pass in be reset, but also that all pointers you've received from previous calls to this function are invalid. And that's the problem here. |
As part of the effort to remove Poco dependency described in this issue ros2/ros2#867 this PR makes use of the recent changes in rcutils ros2/rcutils#215 to load, unload and get symbols from shared libraries instead of using Poco.
Signed-off-by: ahcorde ahcorde@gmail.com