From 60a311fdd6e94767191762a858cf904993a6cbf8 Mon Sep 17 00:00:00 2001 From: Mirko Waechter <mirko.waechter@kit.edu> Date: Wed, 18 May 2016 17:53:43 +0200 Subject: [PATCH] mutex fix in kinematic unit gui --- .../KinematicUnitGuiPlugin.cpp | 35 ++++++++++++------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/source/RobotAPI/gui-plugins/KinematicUnitPlugin/KinematicUnitGuiPlugin.cpp b/source/RobotAPI/gui-plugins/KinematicUnitPlugin/KinematicUnitGuiPlugin.cpp index 72df5f416..f712c2ecd 100644 --- a/source/RobotAPI/gui-plugins/KinematicUnitPlugin/KinematicUnitGuiPlugin.cpp +++ b/source/RobotAPI/gui-plugins/KinematicUnitPlugin/KinematicUnitGuiPlugin.cpp @@ -940,14 +940,15 @@ QString KinematicUnitWidgetController::translateStatus(ErrorStatus status) void KinematicUnitWidgetController::updateJointAnglesTable() { - if (!robotNodeSet) - { - return; - } + float dirty_squaresum = 0; boost::recursive_mutex::scoped_lock lock(mutexNodeSet); + if (!robotNodeSet) + { + return; + } std::vector< RobotNodePtr > rn = robotNodeSet->getAllRobotNodes(); @@ -983,13 +984,17 @@ void KinematicUnitWidgetController::updateJointAnglesTable() void KinematicUnitWidgetController::updateJointVelocitiesTable() { - if (!getWidget() || !robotNodeSet) + if (!getWidget()) { return; } float dirty_squaresum = 0; boost::recursive_mutex::scoped_lock lock(mutexNodeSet); + if (!robotNodeSet) + { + return; + } std::vector< RobotNodePtr > rn = robotNodeSet->getAllRobotNodes(); QTableWidgetItem* newItem; @@ -1019,12 +1024,13 @@ void KinematicUnitWidgetController::updateJointVelocitiesTable() void KinematicUnitWidgetController::updateJointTorquesTable() { + + + boost::recursive_mutex::scoped_lock lock(mutexNodeSet); if (!getWidget() || !robotNodeSet) { return; } - - boost::recursive_mutex::scoped_lock lock(mutexNodeSet); std::vector< RobotNodePtr > rn = robotNodeSet->getAllRobotNodes(); QTableWidgetItem* newItem; NameValueMap::const_iterator it; @@ -1046,12 +1052,13 @@ void KinematicUnitWidgetController::updateJointTorquesTable() void KinematicUnitWidgetController::updateJointCurrentsTable() { + + + boost::recursive_mutex::scoped_lock lock(mutexNodeSet); if (!getWidget() || !robotNodeSet) { return; } - - boost::recursive_mutex::scoped_lock lock(mutexNodeSet); std::vector< RobotNodePtr > rn = robotNodeSet->getAllRobotNodes(); QTableWidgetItem* newItem; NameValueMap::const_iterator it; @@ -1073,12 +1080,13 @@ void KinematicUnitWidgetController::updateJointCurrentsTable() void KinematicUnitWidgetController::updateJointMotorTemperaturesTable() { + + boost::recursive_mutex::scoped_lock lock(mutexNodeSet); if (!getWidget() || !robotNodeSet) { return; } - boost::recursive_mutex::scoped_lock lock(mutexNodeSet); std::vector< RobotNodePtr > rn = robotNodeSet->getAllRobotNodes(); QTableWidgetItem* newItem; NameValueMap::const_iterator it; @@ -1198,13 +1206,14 @@ void KinematicUnitWidgetController::reportJointStatuses(const NameStatusMap& joi void KinematicUnitWidgetController::updateModel() { + + + // ARMARX_INFO << "updateModel()" << flush; + boost::recursive_mutex::scoped_lock lock(mutexNodeSet); if (!robotNodeSet) { return; } - - // ARMARX_INFO << "updateModel()" << flush; - boost::recursive_mutex::scoped_lock lock(mutexNodeSet); std::vector< RobotNodePtr > rn2 = robotNodeSet->getAllRobotNodes(); std::vector< RobotNodePtr > usedNodes; -- GitLab