From 1c33cf4ffa4bedede8fdf8727477b0f42f205b70 Mon Sep 17 00:00:00 2001 From: Mirko Waechter <mirko.waechter@kit.edu> Date: Fri, 20 May 2016 18:06:22 +0200 Subject: [PATCH] fix #2 --- .../components/DebugDrawer/DebugDrawerComponent.cpp | 8 +++++--- .../components/DebugDrawer/DebugDrawerComponent.h | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/source/RobotAPI/components/DebugDrawer/DebugDrawerComponent.cpp b/source/RobotAPI/components/DebugDrawer/DebugDrawerComponent.cpp index d9748e51b..858ebc50d 100644 --- a/source/RobotAPI/components/DebugDrawer/DebugDrawerComponent.cpp +++ b/source/RobotAPI/components/DebugDrawer/DebugDrawerComponent.cpp @@ -295,6 +295,7 @@ namespace armarx return; } + ScopedLock lock(drawer->timerSensorMutex); drawer->updateVisualization(); } @@ -332,6 +333,7 @@ namespace armarx //ARMARX_DEBUG << "onExitComponent"; if (timerSensor) { + ScopedLock lock(timerSensorMutex); SoSensorManager* sensor_mgr = SoDB::getSensorManager(); sensor_mgr->removeTimerSensor(timerSensor); } @@ -757,17 +759,17 @@ namespace armarx TriMeshModelPtr triMesh = TriMeshModelPtr(new TriMeshModel()); - for(DrawColor color : d.triMesh.colors) + for (DrawColor color : d.triMesh.colors) { triMesh->addColor(VirtualRobot::VisualizationFactory::Color(color.r, color.g, color.b, color.a)); } - for(DebugDrawerVertex v : d.triMesh.vertices) + for (DebugDrawerVertex v : d.triMesh.vertices) { triMesh->addVertex(Eigen::Vector3f(v.x, v.y, v.z)); } - for(DebugDrawerFace f : d.triMesh.faces) + for (DebugDrawerFace f : d.triMesh.faces) { MathTools::TriangleFace face; diff --git a/source/RobotAPI/components/DebugDrawer/DebugDrawerComponent.h b/source/RobotAPI/components/DebugDrawer/DebugDrawerComponent.h index dbf74aacd..7d50c82a8 100644 --- a/source/RobotAPI/components/DebugDrawer/DebugDrawerComponent.h +++ b/source/RobotAPI/components/DebugDrawer/DebugDrawerComponent.h @@ -547,6 +547,7 @@ namespace armarx float cycleTimeMS; //PeriodicTask<DebugDrawerComponent>::pointer_type execTaskVisuUpdates; SoTimerSensor* timerSensor; + Mutex timerSensorMutex; void removeAccumulatedData(const std::string& layerName); }; -- GitLab