Skip to content
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

gimbal: fix unregister message subscription #2208

Merged
merged 1 commit into from
Jan 12, 2024

Conversation

julianoes
Copy link
Collaborator

We should unregister anything we have subscribed to when being destructed.

Related to #2207

We should unregister anything we have subscribed to when being
destructed.

Signed-off-by: Julian Oes <julian@oes.ch>
@julianoes julianoes force-pushed the pr-fix-gimbal-heap-bug branch from 1d94390 to 5157b1a Compare January 12, 2024 00:00
Comment on lines +24 to +26
_is_mavlink_manager_status_registered = false;

_system_impl.unregister_mavlink_message_handler(MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS, this);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if it matters, but I'm always more comfortable setting the boolean after the fact (i.e. inverting those lines). So that it reads "now that I unregistered, I update the boolean that holds the registration state".

Probably just a nitpick though.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The advantage of that way is that the check and set are right after each other and less likely to drift apart from each other and get lost.

Best case, it should not be a two step approach but one. Actually, we don't need this variable. We can just unregister and if we haven't registered it's silently ignored...

@JonasVautherin JonasVautherin merged commit c263fde into main Jan 12, 2024
27 checks passed
@JonasVautherin JonasVautherin deleted the pr-fix-gimbal-heap-bug branch January 12, 2024 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants