Skip to content

Commit

Permalink
Fix vibe-d#2484 - clear m_fill on flush exception
Browse files Browse the repository at this point in the history
  • Loading branch information
tchaloupka committed Oct 19, 2020
1 parent b5afadb commit e8a387f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion stream/vibe/stream/wrapper.d
Expand Up @@ -309,14 +309,15 @@ struct StreamOutputRange(OutputStream, size_t buffer_size = 256)

~this()
{
scope (failure) () @trusted { destroy(m_stream); }(); // workaround for #2484
flush();
}

void flush()
{
if (m_fill == 0) return;
scope (exit) m_fill = 0;
m_stream.write(m_data[0 .. m_fill]);
m_fill = 0;
}

void drop()
Expand Down

0 comments on commit e8a387f

Please sign in to comment.