Skip to content

Commit

Permalink
Don't free StreamWriter buffer until after callbacks
Browse files Browse the repository at this point in the history
* Some callbacks may want to process the data so we can't free it out from under
  them.
  • Loading branch information
baldurk committed Jun 9, 2023
1 parent 96e39bb commit 98f2ad0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions renderdoc/serialise/streamio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -771,8 +771,6 @@ StreamWriter::StreamWriter(Compressor *compressor, Ownership own)

StreamWriter::~StreamWriter()
{
FreeAlignedBuffer(m_BufferBase);

if(m_Ownership == Ownership::Stream)
{
if(m_File)
Expand All @@ -789,6 +787,8 @@ StreamWriter::~StreamWriter()

for(StreamCloseCallback cb : m_Callbacks)
cb();

FreeAlignedBuffer(m_BufferBase);
}

bool StreamWriter::SendSocketData(const void *data, uint64_t numBytes)
Expand Down

0 comments on commit 98f2ad0

Please sign in to comment.