From 1c1639894113f2c46939f6a66befe07de2d539bd Mon Sep 17 00:00:00 2001 From: mrkraimer Date: Thu, 1 Aug 2019 14:20:52 -0400 Subject: [PATCH] fix issue49 ; remove instead of destroy --- src/pvaccess/PvaServer.cpp | 6 +----- src/pvaccess/PyPvRecord.cpp | 5 ----- src/pvaccess/PyPvRecord.h | 1 - test/issue49.py | 7 +++++++ 4 files changed, 8 insertions(+), 11 deletions(-) create mode 100644 test/issue49.py diff --git a/src/pvaccess/PvaServer.cpp b/src/pvaccess/PvaServer.cpp index 5b44df2e..a3e1eb44 100644 --- a/src/pvaccess/PvaServer.cpp +++ b/src/pvaccess/PvaServer.cpp @@ -146,11 +146,7 @@ void PvaServer::removeRecord(const std::string& channelName) if (it == recordMap.end()) { throw ObjectNotFound("Master database does not have record for channel: " + channelName); } - - epics::pvDatabase::PVDatabasePtr master = epics::pvDatabase::PVDatabase::getMaster(); - if(!master->removeRecord(it->second)) { - throw PvaException("Cannot remove record to master database for channel: " + channelName); - } + it->second->remove(); recordMap.erase(it); } diff --git a/src/pvaccess/PyPvRecord.cpp b/src/pvaccess/PyPvRecord.cpp index fd886387..72540c82 100644 --- a/src/pvaccess/PyPvRecord.cpp +++ b/src/pvaccess/PyPvRecord.cpp @@ -37,11 +37,6 @@ bool PyPvRecord::init() return true; } -void PyPvRecord::destroy() -{ - epics::pvDatabase::PVRecord::destroy(); -} - void PyPvRecord::process() { if(PyUtility::isPyNone(onWriteCallback)) { diff --git a/src/pvaccess/PyPvRecord.h b/src/pvaccess/PyPvRecord.h index d7c42f4e..528411cd 100644 --- a/src/pvaccess/PyPvRecord.h +++ b/src/pvaccess/PyPvRecord.h @@ -25,7 +25,6 @@ class PyPvRecord : POINTER_DEFINITIONS(PyPvRecord); virtual ~PyPvRecord(); virtual bool init(); - virtual void destroy(); virtual void process(); void update (const PvObject& pvObject); void executeCallback(); diff --git a/test/issue49.py b/test/issue49.py new file mode 100644 index 00000000..3c59df31 --- /dev/null +++ b/test/issue49.py @@ -0,0 +1,7 @@ +#!/usr/bin/env python +import pvaccess as pva + +s = pva.PvaServer('foo', pva.PvObject({'value': pva.INT})) +c = pva.Channel('foo') +c.get() +s.removeRecord('foo')