diff --git a/source/RobotAPI/components/DebugDrawer/DebugDrawerComponent.cpp b/source/RobotAPI/components/DebugDrawer/DebugDrawerComponent.cpp index d9748e51b764e6be50397069b63ea4a58e188238..858ebc50d1739dc2b7ef8dfcb54e316597ae800e 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 dbf74aacdb8907dc0714f916104e43938e556bb7..7d50c82a89f282e883f8867dc90673af3c826dc2 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); };