core/debugger: fix crash due to incorrect lambda capture

This commit is contained in:
Liam 2022-06-06 23:39:48 -04:00
parent 708e5b027f
commit d00b7be2d6
1 changed files with 9 additions and 8 deletions

View File

@ -20,7 +20,8 @@ template <typename Readable, typename Buffer, typename Callback>
static void AsyncReceiveInto(Readable& r, Buffer& buffer, Callback&& c) { static void AsyncReceiveInto(Readable& r, Buffer& buffer, Callback&& c) {
static_assert(std::is_trivial_v<Buffer>); static_assert(std::is_trivial_v<Buffer>);
auto boost_buffer{boost::asio::buffer(&buffer, sizeof(Buffer))}; auto boost_buffer{boost::asio::buffer(&buffer, sizeof(Buffer))};
r.async_read_some(boost_buffer, [&](const boost::system::error_code& error, size_t bytes_read) { r.async_read_some(
boost_buffer, [&, c](const boost::system::error_code& error, size_t bytes_read) {
if (!error.failed()) { if (!error.failed()) {
const u8* buffer_start = reinterpret_cast<const u8*>(&buffer); const u8* buffer_start = reinterpret_cast<const u8*>(&buffer);
std::span<const u8> received_data{buffer_start, buffer_start + bytes_read}; std::span<const u8> received_data{buffer_start, buffer_start + bytes_read};