From 7648c4e075336b826bdd84966e6ae3a25ec70c1d Mon Sep 17 00:00:00 2001
From: Raphael Grimm <raphael.grimm@kit.edu>
Date: Mon, 14 Jan 2019 20:09:59 +0100
Subject: [PATCH] Fix ControlThreadOutputBuffer copy ctor to also copy values

---
 .../units/RobotUnit/util/ControlThreadOutputBuffer.cpp     | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/source/RobotAPI/components/units/RobotUnit/util/ControlThreadOutputBuffer.cpp b/source/RobotAPI/components/units/RobotUnit/util/ControlThreadOutputBuffer.cpp
index dea0cefc3..0d0aa5b76 100644
--- a/source/RobotAPI/components/units/RobotUnit/util/ControlThreadOutputBuffer.cpp
+++ b/source/RobotAPI/components/units/RobotUnit/util/ControlThreadOutputBuffer.cpp
@@ -420,12 +420,14 @@ namespace armarx
             return resultPlace;
         };
 
+        //copy sensor values
         sensors.reserve(other.sensors.size());
         for (const SensorValueBase* sv : other.sensors)
         {
-            sensors.emplace_back(sv->_placementConstruct(getAlignedPlace(sv->_sizeof(), sv->_alignof())));
+            sensors.emplace_back(sv->_placementCopyConstruct(getAlignedPlace(sv->_sizeof(), sv->_alignof())));
         }
 
+        //copy control targets
         control.reserve(other.control.size());
         for (const auto& cdctargs : other.control)
         {
@@ -434,8 +436,7 @@ namespace armarx
             ctargs.reserve(cdctargs.size());
             for (const ControlTargetBase* ct : cdctargs)
             {
-                ctargs.emplace_back(ct->_placementConstruct(getAlignedPlace(ct->_sizeof(), ct->_alignof())));
-                ctargs.back()->reset();
+                ctargs.emplace_back(ct->_placementCopyConstruct(getAlignedPlace(ct->_sizeof(), ct->_alignof())));
             }
         }
     }
-- 
GitLab