SharedPV ensure callback pairing

Ensure that onLastDisconnect() isn't called
unless onFirstConnect() is/has been called.
This commit is contained in:
Michael Davidsaver
2018-09-21 10:42:31 -07:00
parent a6eca51fa0
commit 6b463d77e1
3 changed files with 9 additions and 2 deletions

View File

@@ -74,6 +74,7 @@ SharedPV::shared_pointer SharedPV::buildMailbox(pvas::SharedPV::Config *conf)
SharedPV::SharedPV(const std::tr1::shared_ptr<Handler> &handler, pvas::SharedPV::Config *conf)
:config(conf ? *conf : Config())
,handler(handler)
,notifiedConn(false)
,debugLvl(0)
{
REFTRACE_INCREMENT(num_instances);
@@ -264,8 +265,10 @@ void SharedPV::close(bool destroy)
puts.clear();
rpcs.clear();
monitors.clear();
if(!channels.empty())
if(!channels.empty() && notifiedConn) {
p_handler = handler;
notifiedConn = false;
}
channels.clear();
}
}