From 9fe595722cd478434005f0e9d7835f14fd133ca9 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 8 Dec 2015 14:45:27 -0500 Subject: [PATCH] very tricky... ChannelMonitorImpl is lobotomized with the smarts going to MonitorStrategyQueue, both implementing Monitor. While CMI proxies calls poll/release() to MQS, it seems that MQS doesn't proxy destroy() to CMI. So calling destroy() on MQS is a no-op... --- p2pApp/channel.cpp | 4 ++-- p2pApp/moncache.cpp | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/p2pApp/channel.cpp b/p2pApp/channel.cpp index 785dfec..6def769 100644 --- a/p2pApp/channel.cpp +++ b/p2pApp/channel.cpp @@ -180,8 +180,8 @@ GWChannel::createMonitor( // Create upstream monitor // This would create a strong ref. loop between ent and ent->mon. - // Instead we get clever and pass a "fake" strong ref, which simply - // checks to see that it will out-live the object. + // Instead we get clever and pass a "fake" strong ref. + // and ensure that ~MonitorCacheEntry destroy()s the client Monitor MonitorCacheEntry::shared_pointer fakereal(ent.get(), noclean()); ent->mon = entry->channel->createMonitor(fakereal, pvRequest); diff --git a/p2pApp/moncache.cpp b/p2pApp/moncache.cpp index 0398053..255dc0c 100644 --- a/p2pApp/moncache.cpp +++ b/p2pApp/moncache.cpp @@ -80,10 +80,9 @@ MonitorCacheEntry::monitorEvent(pvd::MonitorPtr const & monitor) * The original was a ChannelMonitorImpl, we now see a MonitorStrategyQueue * owned by the original, which delegates deserialization and accumulation * of deltas into complete events for us. + * However, we don't want to keep the MonitorStrategyQueue as it's + * destroy() method is a no-op! */ - assert(monitor==mon || !lastval); - if(!lastval) - mon = monitor; epicsUInt32 cntpoll = 0; //TODO: dequeue and requeue strategy code goes here @@ -91,7 +90,7 @@ MonitorCacheEntry::monitorEvent(pvd::MonitorPtr const & monitor) pvd::MonitorElementPtr update; - while((update=mon->poll())) + while((update=monitor->poll())) { cntpoll++; lastval = update->pvStructurePtr; @@ -126,7 +125,7 @@ MonitorCacheEntry::monitorEvent(pvd::MonitorPtr const & monitor) } } - mon->release(update); + monitor->release(update); } }