Skip to content

Commit

Permalink
Allocate new memory when buffering messages to fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Metater committed Jan 11, 2025
1 parent c056561 commit fa1075d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion com.mirror.steamworks.net/NextClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,12 @@ public void ReceiveData()
}
else
{
BufferedData.Add(() => OnReceivedData(segment, channelId));
// Need to allocate new memory for these recieved messages because the main buffer will be overwritten by the buffered data is processed
byte[] segmentCopy = new byte[segment.Count];
Array.Copy(segment.Array, segment.Offset, segmentCopy, 0, segment.Count);
int channelIdCopy = channelId;

BufferedData.Add(() => OnReceivedData(segmentCopy, channelIdCopy));
}
}
}
Expand Down

0 comments on commit fa1075d

Please sign in to comment.