async_manager: minor bug fix 99/313699/4
authorVibhav Aggarwal <v.aggarwal@samsung.com>
Mon, 1 Jul 2024 06:04:38 +0000 (15:04 +0900)
committerVibhav Aggarwal <v.aggarwal@samsung.com>
Mon, 1 Jul 2024 09:08:44 +0000 (18:08 +0900)
pop() function of std::queue destroys the front object
so it needs to be moved before returning.

Change-Id: I08036b48ec9c6989ea59003ce94c785f721ed378
Signed-off-by: Vibhav Aggarwal <v.aggarwal@samsung.com>
services/common/include/AsyncManager.h

index 329732355c802368da7452a9986ba1721aec0bc3..08bc3c5652687c80dd2c857a62faf0df67664cb4 100644 (file)
@@ -64,7 +64,7 @@ private:
        In popFromInput()
        {
                std::lock_guard<std::mutex> lock(_incoming_queue_mutex);
-               In &data = _incoming_queue.front();
+               In data = std::move(_incoming_queue.front());
 
                _incoming_queue.pop();
 
@@ -74,7 +74,7 @@ private:
        Out popFromOutput()
        {
                std::lock_guard<std::mutex> lock(_outgoing_queue_mutex);
-               Out &output = _outgoing_queue.front();
+               Out output = std::move(_outgoing_queue.front());
 
                _outgoing_queue.pop();