paranoia
This commit is contained in:
@ -23,6 +23,7 @@ struct MonitorCacheEntry : public epics::pvData::MonitorRequester
|
||||
{
|
||||
POINTER_DEFINITIONS(MonitorCacheEntry);
|
||||
static size_t num_instances;
|
||||
weak_pointer weakref;
|
||||
|
||||
ChannelCacheEntry * const chan;
|
||||
|
||||
|
@ -163,7 +163,8 @@ GWChannel::createMonitor(
|
||||
ment = entry->mon_entries.find(ser);
|
||||
if(!ment) {
|
||||
ment.reset(new MonitorCacheEntry(entry.get()));
|
||||
entry->mon_entries[ser] = ment;
|
||||
entry->mon_entries[ser] = ment; // ref. wrapped
|
||||
ment->weakref = ment;
|
||||
|
||||
// Create upstream monitor
|
||||
// This would create a strong ref. loop between ent and ent->mon.
|
||||
|
@ -56,7 +56,7 @@ MonitorCacheEntry::monitorConnect(pvd::Status const & status,
|
||||
if(!startresult.isSuccess())
|
||||
std::cout<<"upstream monitor start() fails\n";
|
||||
|
||||
//TODO: hold a shared_ptr to 'this' incase all MonitorUsers are destroy()d in a callback
|
||||
shared_pointer self(weakref); // keeps us alive all MonitorUsers are destroy()ed
|
||||
|
||||
for(interested_t::vector_type::const_iterator it = tonotify.begin(),
|
||||
end = tonotify.end(); it!=end; ++it)
|
||||
@ -92,7 +92,7 @@ MonitorCacheEntry::monitorEvent(pvd::MonitorPtr const & monitor)
|
||||
|
||||
pvd::MonitorElementPtr update;
|
||||
|
||||
//TODO: hold a shared_ptr to 'this' incase all MonitorUsers are destroy()d in a callback
|
||||
shared_pointer self(weakref); // keeps us alive all MonitorUsers are destroy()ed
|
||||
|
||||
while((update=monitor->poll()))
|
||||
{
|
||||
|
Reference in New Issue
Block a user