From 529438b9e41cdb11988181a6ba45d3b13e592f3a Mon Sep 17 00:00:00 2001 From: Nav Date: Sat, 17 Dec 2022 14:46:08 +0000 Subject: [PATCH] Tidying --- src/Insight/Insight.cpp | 4 +++- .../TargetControllerComponent.hpp | 15 +++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/Insight/Insight.cpp b/src/Insight/Insight.cpp index addd97ab..03d70d66 100644 --- a/src/Insight/Insight.cpp +++ b/src/Insight/Insight.cpp @@ -354,8 +354,10 @@ namespace Bloom if (event.state == TargetControllerState::SUSPENDED) { emit this->insightSignals->targetControllerSuspended(); + return; + } - } else if (event.state == TargetControllerState::ACTIVE) { + if (event.state == TargetControllerState::ACTIVE) { auto* getTargetDescriptorTask = new GetTargetDescriptor(); QObject::connect( diff --git a/src/TargetController/TargetControllerComponent.hpp b/src/TargetController/TargetControllerComponent.hpp index 311f1d16..f753a350 100644 --- a/src/TargetController/TargetControllerComponent.hpp +++ b/src/TargetController/TargetControllerComponent.hpp @@ -165,12 +165,15 @@ namespace Bloom::TargetController */ template void registerCommandHandler(std::function(CommandType&)> callback) { - auto parentCallback = [callback] (Commands::Command& command) { - // Downcast the command to the expected type - return callback(dynamic_cast(command)); - }; - - this->commandHandlersByCommandType.insert(std::pair(CommandType::type, parentCallback)); + this->commandHandlersByCommandType.insert( + std::pair( + CommandType::type, + [callback] (Commands::Command& command) { + // Downcast the command to the expected type + return callback(dynamic_cast(command)); + } + ) + ); } /**