Skip to content

Commit b4e8280

Browse files
committed
Unset handle to cartesian iface on detach
1 parent 1dad371 commit b4e8280

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

libraries/YarpPlugins/CartesianControlServer/CartesianControlServer.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ class RpcResponder : public yarp::dev::DeviceResponder
8585
void setHandle(ICartesianControl * _iCartesianControl)
8686
{ iCartesianControl = _iCartesianControl; }
8787

88+
void unsetHandle()
89+
{ iCartesianControl = nullptr; }
90+
8891
bool respond(const yarp::os::Bottle & in, yarp::os::Bottle & out) override;
8992
void makeUsage();
9093

@@ -151,6 +154,9 @@ class StreamResponder : public yarp::os::TypedReaderCallback<yarp::os::Bottle>
151154
void setHandle(ICartesianControl * _iCartesianControl)
152155
{ iCartesianControl = _iCartesianControl;}
153156

157+
void unsetHandle()
158+
{ iCartesianControl = nullptr; }
159+
154160
void onRead(yarp::os::Bottle & b) override;
155161

156162
private:

libraries/YarpPlugins/CartesianControlServer/IWrapperImpl.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,15 @@ bool CartesianControlServer::attach(yarp::dev::PolyDriver * poly)
5151
bool CartesianControlServer::detach()
5252
{
5353
yarp::os::PeriodicThread::stop();
54+
55+
rpcResponder->unsetHandle();
56+
streamResponder->unsetHandle();
57+
58+
if (rpcTransformResponder)
59+
{
60+
rpcTransformResponder->unsetHandle();
61+
}
62+
5463
iCartesianControl = nullptr;
5564
return true;
5665
}

0 commit comments

Comments
 (0)