Skip to content

Commit

Permalink
Merge pull request #2208 from mavlink/pr-fix-gimbal-heap-bug
Browse files Browse the repository at this point in the history
gimbal: fix unregister message subscription
  • Loading branch information
JonasVautherin authored Jan 12, 2024
2 parents 6f09ba9 + 5157b1a commit c263fde
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/mavsdk/plugins/gimbal/gimbal_protocol_v2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ GimbalProtocolV2::GimbalProtocolV2(
_gimbal_manager_compid(gimbal_manager_compid)
{}

GimbalProtocolV2::~GimbalProtocolV2()
{
if (_is_mavlink_manager_status_registered) {
_is_mavlink_manager_status_registered = false;

_system_impl.unregister_mavlink_message_handler(MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS, this);
}
}

void GimbalProtocolV2::process_gimbal_manager_status(const mavlink_message_t& message)
{
Gimbal::ControlMode new_control_mode;
Expand Down
2 changes: 1 addition & 1 deletion src/mavsdk/plugins/gimbal/gimbal_protocol_v2.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class GimbalProtocolV2 : public GimbalProtocolBase {
const mavlink_gimbal_manager_information_t& information,
uint8_t gimbal_manager_sysid,
uint8_t gimbal_manager_compid);
~GimbalProtocolV2() override = default;
~GimbalProtocolV2() override;

Gimbal::Result set_pitch_and_yaw(float pitch_deg, float yaw_deg) override;
void set_pitch_and_yaw_async(
Expand Down

0 comments on commit c263fde

Please sign in to comment.