-
Notifications
You must be signed in to change notification settings - Fork 300
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 pointers with values #849
Replace pointers with values #849
Conversation
I'm sorry but because of what I know about ClassLoader and how it is unsafe to destroy it; this should stay a shared_ptr. A better change would be to copy the shared_ptr into a global to make sure it has the same lifetime as the process. |
I'm unsure what you mean since the |
If you copy that shared ptr into a global you can extend the lifetime. Making it allocated on the stack gives the user the impression it is safe to delete. |
It sounds like you're describing a bug in the status quo of the library. Does this PR exacerbate that problem?
This is private data. It's nothing users should be able to observe in the first place. |
This looks good to me. Nevertheless, we are also using loaders in “Resource Manager” so the same changes should also be done there. Other than that, since we are now resetting the loader object, we have to be sure that objects created by this loader are really independent of it. Do we have a test for it already? |
because of how class_loader works, this is not true. seem my PR here: |
Are you talking about the EDIT: I have this implemented locally and the diff is a few hundred lines long just to convert a single |
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.
This should be fine. I think we can go with it. It is a bit cleaner.
I see the ABI check is failing which makes sense because changing the layout of a class is a potential ABI break. Does that invalidate this PR or are there options to deal with that? |
@ChrisThrasher I'd not worry too much about the ABI breaking jobs. Look at the result from this job. Relevant print is here:
|
This pull request is in conflict. Could you fix it @ChrisThrasher? |
This causes segmentation fault on runtime-tests - closing. |
* Fix dynamic reconfigure of tolerances * Fix static cast syntax
I found two instances of shared pointers which can be represented as values. Because values have fewer features and few indirections required to use them, they're the better choice in general. I can't think of any reason why these members need to be pointers but if they do, we can still use
unique_ptr
since shared ownership of these members is not necessary.