Skip to content

Commit edc6e32

Browse files
committed
Bug fix in RecordComponent::flush
1 parent 6e841b9 commit edc6e32

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

src/RecordComponent.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -488,13 +488,17 @@ void RecordComponent::flush(
488488
{
489489
return;
490490
}
491-
if (access::readOnly(IOHandler()->m_frontendAccess) &&
492-
flush_level::global_flushpoint(flushParams.flushLevel))
491+
if (access::readOnly(IOHandler()->m_frontendAccess))
493492
{
494-
while (!rc.m_chunks.empty())
493+
// sic! this needs to be a separate if term, otherwise flushes may
494+
// wrongly jump into the write branch below
495+
if (flush_level::global_flushpoint(flushParams.flushLevel))
495496
{
496-
IOHandler()->enqueue(rc.m_chunks.front());
497-
rc.m_chunks.pop();
497+
while (!rc.m_chunks.empty())
498+
{
499+
IOHandler()->enqueue(rc.m_chunks.front());
500+
rc.m_chunks.pop();
501+
}
498502
}
499503
}
500504
else

0 commit comments

Comments
 (0)