From 74fb8cd101173c63c4b12dc149b0c983a8456614 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Tue, 24 Oct 2023 07:10:42 +1300 Subject: [PATCH] core: clean up message registrations Signed-off-by: Julian Oes --- src/mavsdk/core/mavlink_ftp_client.cpp | 5 ++++- src/mavsdk/core/mavlink_ftp_server.cpp | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mavsdk/core/mavlink_ftp_client.cpp b/src/mavsdk/core/mavlink_ftp_client.cpp index 156f7a9cce..e4e74f051a 100644 --- a/src/mavsdk/core/mavlink_ftp_client.cpp +++ b/src/mavsdk/core/mavlink_ftp_client.cpp @@ -26,7 +26,10 @@ MavlinkFtpClient::MavlinkFtpClient(SystemImpl& system_impl) : _system_impl(syste this); } -MavlinkFtpClient::~MavlinkFtpClient() {} +MavlinkFtpClient::~MavlinkFtpClient() +{ + _system_impl.unregister_all_mavlink_message_handlers(this); +} void MavlinkFtpClient::do_work() { diff --git a/src/mavsdk/core/mavlink_ftp_server.cpp b/src/mavsdk/core/mavlink_ftp_server.cpp index f61d555680..2bad1793f2 100644 --- a/src/mavsdk/core/mavlink_ftp_server.cpp +++ b/src/mavsdk/core/mavlink_ftp_server.cpp @@ -190,6 +190,8 @@ void MavlinkFtpServer::process_mavlink_ftp_message(const mavlink_message_t& msg) MavlinkFtpServer::~MavlinkFtpServer() { + _server_component_impl.unregister_all_mavlink_message_handlers(this); + std::lock_guard lock(_mutex); _reset(); }