From d00b7be2d68d059b7ab6d6fdb367f7b307a48e87 Mon Sep 17 00:00:00 2001 From: Liam Date: Mon, 6 Jun 2022 23:39:48 -0400 Subject: core/debugger: fix crash due to incorrect lambda capture --- src/core/debugger/debugger.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/core/debugger') diff --git a/src/core/debugger/debugger.cpp b/src/core/debugger/debugger.cpp index 68ab33e46..69b7d987d 100644 --- a/src/core/debugger/debugger.cpp +++ b/src/core/debugger/debugger.cpp @@ -20,15 +20,16 @@ template static void AsyncReceiveInto(Readable& r, Buffer& buffer, Callback&& c) { static_assert(std::is_trivial_v); 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) { - if (!error.failed()) { - const u8* buffer_start = reinterpret_cast(&buffer); - std::span received_data{buffer_start, buffer_start + bytes_read}; - c(received_data); - } + r.async_read_some( + boost_buffer, [&, c](const boost::system::error_code& error, size_t bytes_read) { + if (!error.failed()) { + const u8* buffer_start = reinterpret_cast(&buffer); + std::span received_data{buffer_start, buffer_start + bytes_read}; + c(received_data); + } - AsyncReceiveInto(r, buffer, c); - }); + AsyncReceiveInto(r, buffer, c); + }); } template -- cgit v1.2.3