From b8a8db61c1a98681e9d2e39e1a6d4259b3a4ad05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beat=20K=C3=BCng?= Date: Thu, 17 Dec 2020 19:23:35 +0100 Subject: [PATCH] fix MavlinkConsoleController: weakLink.expired() logic was inverted (#9259) And removes the extra expired() call (less atomic ops). --- src/AnalyzeView/MavlinkConsoleController.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/AnalyzeView/MavlinkConsoleController.cc b/src/AnalyzeView/MavlinkConsoleController.cc index dcadc70..9509250 100644 --- a/src/AnalyzeView/MavlinkConsoleController.cc +++ b/src/AnalyzeView/MavlinkConsoleController.cc @@ -110,11 +110,10 @@ MavlinkConsoleController::_sendSerialData(QByteArray data, bool close) return; } - WeakLinkInterfacePtr weakLink = _vehicle->vehicleLinkManager()->primaryLink(); - if (!weakLink.expired()) { + SharedLinkInterfacePtr sharedLink = _vehicle->vehicleLinkManager()->primaryLink().lock(); + if (!sharedLink) { return; } - SharedLinkInterfacePtr sharedLink = weakLink.lock(); // Send maximum sized chunks until the complete buffer is transmitted while(data.size()) {