From d2160659b0e8d87542d04b1625e06f0417f5043e Mon Sep 17 00:00:00 2001 From: Matt Firth Date: Mon, 13 May 2024 16:32:34 +0100 Subject: [PATCH] Avoid unnecessary copy in async lambda --- .../lib/src/communication/monitoring_metadata_receiver.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ear-production-suite-plugins/lib/src/communication/monitoring_metadata_receiver.cpp b/ear-production-suite-plugins/lib/src/communication/monitoring_metadata_receiver.cpp index fd6a96d2..906533cc 100644 --- a/ear-production-suite-plugins/lib/src/communication/monitoring_metadata_receiver.cpp +++ b/ear-production-suite-plugins/lib/src/communication/monitoring_metadata_receiver.cpp @@ -65,10 +65,10 @@ void MonitoringMetadataReceiver::handleReceive(std::error_code ec, } // Called by NNG callback on thread with small stack. // Launch task in another thread to overcome stack limitation. - auto future = std::async(std::launch::async, [this, sceneStore]() { + auto future = std::async(std::launch::async, [this, sceneStore = std::move(sceneStore)]() { handler_(sceneStore); }); - future.get(); + future.get(); //blocking } catch (const std::runtime_error& e) { EAR_LOGGER_ERROR( logger_, "Failed to parse and dispatch scene metadata: {}", e.what());