Skip to content

Commit

Permalink
RTDEClient: pause and stop in destructor only if running
Browse files Browse the repository at this point in the history
Otherwise we produce an error when destructing an initialized, but
non-started client.
  • Loading branch information
urfeex committed Jan 31, 2025
1 parent ce779b3 commit 94cbff5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/rtde/rtde_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -445,10 +445,13 @@ void RTDEClient::setupInputs()
void RTDEClient::disconnect()
{
// If communication is started it should be paused before disconnecting
if (client_state_ > ClientState::UNINITIALIZED)
if (client_state_ == ClientState::RUNNING)
{
sendPause();
pipeline_->stop();
}
if (client_state_ > ClientState::UNINITIALIZED)
{
stream_.disconnect();
}
client_state_ = ClientState::UNINITIALIZED;
Expand Down

0 comments on commit 94cbff5

Please sign in to comment.