Avoid storing lambda as a local variable (#4687)

Parameters to the TryWriteBacking call were getting corrupted during async texture downloads after #4593
This commit is contained in:
Stephen Miller
2026-07-08 12:17:49 -05:00
committed by GitHub
parent 48f4bf889e
commit aa18760e5e
@@ -124,16 +124,16 @@ void TextureCache::DownloadImageMemory(ImageId image_id, bool sync) {
cmdbuf.copyImageToBuffer(image.GetImage(), vk::ImageLayout::eTransferSrcOptimal, cmdbuf.copyImageToBuffer(image.GetImage(), vk::ImageLayout::eTransferSrcOptimal,
download_buffer.Handle(), image_download); download_buffer.Handle(), image_download);
const auto write_data = [this, device_addr = image.info.guest_address, download,
download_size] {
Core::Memory::Instance()->TryWriteBacking(std::bit_cast<u8*>(device_addr), download,
download_size);
};
if (sync) { if (sync) {
scheduler.Finish(); scheduler.Finish();
write_data(); Core::Memory::Instance()->TryWriteBacking(std::bit_cast<u8*>(image.info.guest_address),
download, download_size);
} else { } else {
scheduler.DeferPriorityOperation(write_data); scheduler.DeferPriorityOperation(
[this, device_addr = image.info.guest_address, download, download_size] {
Core::Memory::Instance()->TryWriteBacking(std::bit_cast<u8*>(device_addr), download,
download_size);
});
} }
} }