-
Notifications
You must be signed in to change notification settings - Fork 997
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
On the way to fixing #1919 #1920
base: ros2
Are you sure you want to change the base?
Conversation
mavros/include/mavros/plugin.hpp
Outdated
@@ -110,7 +101,7 @@ class Plugin : public std::enable_shared_from_this<Plugin> | |||
} | |||
|
|||
protected: | |||
UASPtr uas; // uas back link | |||
std::weak_ptr<UAS> uas_; // uas back link |
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.
What for? Shared ptr good enough.
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.
shared_ptr
is not good here, because it creates cyclic references. The UAS node holds shared_ptr
s to plugin nodes. In turn, each plugin node holds a shared_ptr
to the UAS node. The result is that the UAS node and the plugin nodes never get destroyed.
You can check this by loading the mavros::uas::UAS
component into a component container and then unloading it. The nodes will still be there. And then load it again, every node will get duplicated.
0d95358
to
98c538e
Compare
- Removed unnecessary dynamic_pointer_cast<>'s Removed unused Plugin ctor
Prohibit copying and moving of UAS Removed startup_delay_timer
98c538e
to
fe0e21d
Compare
No description provided.