Skip to content

Commit d9fce66

Browse files
Don't allow Container insertion in READ_LINEAR (#1590)
Also clear the IO queue after failed flushes
1 parent 8faadde commit d9fce66

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

include/openPMD/backend/Container.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#pragma once
2222

2323
#include "openPMD/Error.hpp"
24+
#include "openPMD/IO/Access.hpp"
2425
#include "openPMD/backend/Attributable.hpp"
2526

2627
#include <initializer_list>
@@ -289,7 +290,7 @@ class Container : virtual public Attributable
289290
{
290291
if (IOHandler()->m_seriesStatus !=
291292
internal::SeriesStatus::Parsing &&
292-
Access::READ_ONLY == IOHandler()->m_frontendAccess)
293+
access::readOnly(IOHandler()->m_frontendAccess))
293294
{
294295
auxiliary::OutOfRangeMsg const out_of_range_msg;
295296
throw std::out_of_range(out_of_range_msg(key));
@@ -330,7 +331,7 @@ class Container : virtual public Attributable
330331
{
331332
if (IOHandler()->m_seriesStatus !=
332333
internal::SeriesStatus::Parsing &&
333-
Access::READ_ONLY == IOHandler()->m_frontendAccess)
334+
access::readOnly(IOHandler()->m_frontendAccess))
334335
{
335336
auxiliary::OutOfRangeMsg out_of_range_msg;
336337
throw std::out_of_range(out_of_range_msg(key));

src/Series.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,12 @@ std::future<void> Series::flush_impl(
737737
}
738738
catch (...)
739739
{
740-
IOHandler()->m_lastFlushSuccessful = false;
740+
auto handler = IOHandler();
741+
handler->m_lastFlushSuccessful = false;
742+
while (!handler->m_work.empty())
743+
{
744+
handler->m_work.pop();
745+
}
741746
throw;
742747
}
743748
}

0 commit comments

Comments
 (0)