Skip to content

Commit

Permalink
Merge pull request #2311 from mavlink/pr-fix-rally-points
Browse files Browse the repository at this point in the history
mission_raw: fix upload race condition
  • Loading branch information
julianoes authored May 23, 2024
2 parents ddb9f3b + 3cb287f commit a326bd9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/mavsdk/plugins/mission_raw/mission_raw_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ void MissionRawImpl::upload_mission_items_async(
uint8_t type,
const MissionRaw::ResultCallback& callback)
{
if (_last_upload.lock()) {
auto work_item = _last_upload.lock();
if (work_item && !work_item->is_done()) {
_system_impl->call_user_callback([callback]() {
if (callback) {
callback(MissionRaw::Result::Busy);
Expand Down Expand Up @@ -227,7 +228,8 @@ MissionRawImpl::download_mission()

void MissionRawImpl::download_mission_async(const MissionRaw::DownloadMissionCallback& callback)
{
if (_last_download.lock()) {
auto work_item = _last_download.lock();
if (work_item && !work_item->is_done()) {
_system_impl->call_user_callback([callback]() {
if (callback) {
std::vector<MissionRaw::MissionItem> empty_items;
Expand Down

0 comments on commit a326bd9

Please sign in to comment.