diff --git a/moveit_ros/robot_interaction/src/locked_robot_state.cpp b/moveit_ros/robot_interaction/src/locked_robot_state.cpp index 15b8d0c845..35c859bdac 100644 --- a/moveit_ros/robot_interaction/src/locked_robot_state.cpp +++ b/moveit_ros/robot_interaction/src/locked_robot_state.cpp @@ -66,7 +66,7 @@ void robot_interaction::LockedRobotState::setState(const moveit::core::RobotStat // If someone else has a reference to the state, then make a new copy. // The old state is orphaned (does not change, but is now out of date). - if (state_.unique()) + if (state_.use_count() == 1) { *state_ = state; } @@ -87,7 +87,7 @@ void robot_interaction::LockedRobotState::modifyState(const ModifyStateFunction& // If someone else has a reference to the state, then make a copy. // The old state is orphaned (does not change, but is now out of date). - if (!state_.unique()) + if (state_.use_count() != 1) state_ = std::make_shared(*state_); modify(state_.get());