From 30b040465a0d73541f8b9d50dc370bd80821e3f7 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Sat, 11 Feb 2023 11:02:59 -0800 Subject: [PATCH] fix Value::unmark() w/ parents=true --- src/data.cpp | 2 +- src/pvxs/data.h | 3 ++- test/testdata.cpp | 6 +++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/data.cpp b/src/data.cpp index 019a3fd..e85db2b 100644 --- a/src/data.cpp +++ b/src/data.cpp @@ -291,8 +291,8 @@ void Value::unmark(bool parents, bool children) auto pdesc = desc; auto pstore = store.get(); while(pdesc!=top->desc.get()) { - pdesc -= pdesc->parent_index; pstore -= pdesc->parent_index; + pdesc -= pdesc->parent_index; pstore->valid = false; } diff --git a/src/pvxs/data.h b/src/pvxs/data.h index e710b64..78c5179 100644 --- a/src/pvxs/data.h +++ b/src/pvxs/data.h @@ -567,7 +567,8 @@ public: Value ifMarked(bool parents=true, bool children=false) const; //! Mark this field as valid/changed void mark(bool v=true); - //! Remove mark from this field + //! Remove mark from this field, and optionally parent and/or child fields. + //! \since UNRELEASED Correctly unmark parent fields void unmark(bool parents=false, bool children=true); //! Type of the referenced field (or Null) diff --git a/test/testdata.cpp b/test/testdata.cpp index 2286637..fc22a2a 100644 --- a/test/testdata.cpp +++ b/test/testdata.cpp @@ -160,6 +160,10 @@ void testIterStruct() val["timeStamp"].mark(); // 4 fields (struct node and 3x leaves) testMarked(6u)<<"mark multiple sub-struct"; + + val["timeStamp.nanoseconds"].unmark(true); + + testMarked(2u)<<"mark multiple sub-struct"; } void testIterUnion() @@ -391,7 +395,7 @@ void testClear() MAIN(testdata) { - testPlan(132); + testPlan(133); testSetup(); testTraverse(); testAssign();