SharedPV.close() call onLastDisconnect()
ensure that onLastDisconnect() is called when the channels list becomes empty (edge), and not afterwards.
This commit is contained in:
@@ -225,6 +225,7 @@ void SharedPV::close(bool destroy)
|
||||
xrpcs_t p_rpc;
|
||||
xmonitors_t p_monitor;
|
||||
xchannels_t p_channel;
|
||||
Handler::shared_pointer p_handler;
|
||||
{
|
||||
Guard I(mutex);
|
||||
|
||||
@@ -259,7 +260,10 @@ void SharedPV::close(bool destroy)
|
||||
puts.clear();
|
||||
rpcs.clear();
|
||||
monitors.clear();
|
||||
bool wasempty = channels.empty();
|
||||
channels.clear();
|
||||
if(!wasempty && channels.empty())
|
||||
p_handler = handler;
|
||||
}
|
||||
}
|
||||
FOR_EACH(xputs_t::iterator, it, end, p_put) {
|
||||
@@ -276,6 +280,10 @@ void SharedPV::close(bool destroy)
|
||||
if(!req) continue;
|
||||
req->channelStateChange(*it, destroy ? pva::Channel::DESTROYED : pva::Channel::DISCONNECTED);
|
||||
}
|
||||
if(p_handler) {
|
||||
shared_pointer self(internal_self);
|
||||
p_handler->onLastDisconnect(self);
|
||||
}
|
||||
}
|
||||
|
||||
pvd::PVStructure::shared_pointer SharedPV::build()
|
||||
|
||||
Reference in New Issue
Block a user