diff --git a/src/Series.cpp b/src/Series.cpp index c3fa4ff774..1363d431ba 100644 --- a/src/Series.cpp +++ b/src/Series.cpp @@ -1131,10 +1131,22 @@ std::optional > Series::readGorVBased(bool do_init) IOHandler()->enqueue(IOTask(&series.iterations, pOpen)); readAttributes(ReadMode::IgnoreExisting); + + auto withRWAccess = [this](auto &&functor) { + auto oldType = IOHandler()->m_frontendAccess; + auto newType = const_cast(&IOHandler()->m_frontendAccess); + *newType = Access::READ_WRITE; + std::forward(functor)(); + *newType = oldType; + }; + /* * 'snapshot' changes over steps, so reread that. */ - series.iterations.readAttributes(ReadMode::OverrideExisting); + withRWAccess([&series]() { + series.iterations.readAttributes(ReadMode::OverrideExisting); + }); + /* obtain all paths inside the basepath (i.e. all iterations) */ Parameter pList; IOHandler()->enqueue(IOTask(&series.iterations, pList)); @@ -1158,7 +1170,12 @@ std::optional > Series::readGorVBased(bool do_init) { pOpen.path = path; IOHandler()->enqueue(IOTask(&i, pOpen)); + auto oldType = IOHandler()->m_frontendAccess; + auto newType = + const_cast(&IOHandler()->m_frontendAccess); + *newType = Access::READ_WRITE; i.reread(path); + *newType = oldType; } } else @@ -1227,7 +1244,7 @@ std::optional > Series::readGorVBased(bool do_init) for (auto const &it : *pList.paths) { uint64_t index = std::stoull(it); - readSingleIteration(index, it, true); + withRWAccess([&]() { readSingleIteration(index, it, true); }); } if (currentSteps.has_value()) { @@ -1247,7 +1264,7 @@ std::optional > Series::readGorVBased(bool do_init) } for (auto it : res) { - readSingleIteration(it, "", false); + withRWAccess([&]() { readSingleIteration(it, "", false); }); } return res; }