Skip to content

Commit

Permalink
gimbal: prevent segfault without gimbal v2 forced
Browse files Browse the repository at this point in the history
It turns out this needed to be locked after all.

Signed-off-by: Julian Oes <julian@oes.ch>
  • Loading branch information
julianoes committed May 16, 2024
1 parent 2dc8e76 commit 683d2ac
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/mavsdk/plugins/gimbal/gimbal_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,7 @@ Gimbal::ControlHandle GimbalImpl::subscribe_control(const Gimbal::ControlCallbac

if (result.first) {
wait_for_protocol_async([=]() {
// We don't lock here because we don't expect the protocol to change once it has been
// set.
std::lock_guard<std::mutex> lock(_mutex);
_gimbal_protocol->control_async([this](Gimbal::ControlStatus status) {
_control_subscriptions.queue(
status, [this](const auto& func) { _system_impl->call_user_callback(func); });
Expand Down Expand Up @@ -254,8 +253,7 @@ Gimbal::AttitudeHandle GimbalImpl::subscribe_attitude(const Gimbal::AttitudeCall

if (result.first) {
wait_for_protocol_async([=]() {
// We don't lock here because we don't expect the protocol to change once it has been
// set.
std::lock_guard<std::mutex> lock(_mutex);
_gimbal_protocol->attitude_async([this](Gimbal::Attitude attitude) {
_attitude_subscriptions.queue(
attitude, [this](const auto& func) { _system_impl->call_user_callback(func); });
Expand Down

0 comments on commit 683d2ac

Please sign in to comment.