LibWeb: Actually protect buffer in create_bitmap_from_bitmap_data()

We were capturing a copy of the ByteBuffer instead of moving it into the
closure.
This commit is contained in:
Andreas Kling 2025-12-27 15:58:38 +01:00 committed by Andreas Kling
parent 692368696f
commit 207d82f8bc
Notes: github-actions[bot] 2025-12-27 15:41:45 +00:00

View file

@ -18,7 +18,7 @@ GC_DEFINE_ALLOCATOR(ImageBitmap);
[[nodiscard]] static auto create_bitmap_from_bitmap_data(Gfx::BitmapFormat const format, Gfx::AlphaType const alpha_type, u32 const width, u32 const height, u32 const pitch, ByteBuffer data)
{
// NB: The data is captured by value in the destruction callback lambda to ensure its lifetime.
return Gfx::Bitmap::create_wrapper(format, alpha_type, Gfx::IntSize(width, height), pitch, data.data(), [data] { });
return Gfx::Bitmap::create_wrapper(format, alpha_type, Gfx::IntSize(width, height), pitch, data.data(), [data = move(data)] { });
}
static void serialize_bitmap(HTML::TransferDataEncoder& encoder, RefPtr<Gfx::Bitmap> const& bitmap)