From 31c5cdcbd5cf281300e7f3a94f06ab5aed41cec2 Mon Sep 17 00:00:00 2001 From: Matthew Olsson Date: Sun, 7 Apr 2024 16:30:15 -0700 Subject: [PATCH] LibWeb+Assistant: Do not ref-capture stack vars in deferred lambdas --- Userland/Applications/Assistant/main.cpp | 2 +- Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Userland/Applications/Assistant/main.cpp b/Userland/Applications/Assistant/main.cpp index a80e3df33e..f265ef62f2 100644 --- a/Userland/Applications/Assistant/main.cpp +++ b/Userland/Applications/Assistant/main.cpp @@ -258,7 +258,7 @@ ErrorOr serenity_main(Main::Arguments arguments) } mark_selected_item(); - Core::deferred_invoke([&] { window->resize(GUI::Desktop::the().rect().width() / 3, {}); }); + Core::deferred_invoke([window] { window->resize(GUI::Desktop::the().rect().width() / 3, {}); }); })); db.on_new_results = [&](auto results) { diff --git a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp index c69bc9ad42..7498859450 100644 --- a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp @@ -664,7 +664,7 @@ void BlockFormattingContext::layout_block_level_box(Box const& box, BlockContain m_margin_state.reset(); } else if (!m_margin_state.has_block_container_waiting_for_final_y_position()) { // margin-top of block container can be updated during children layout hence it's final y position yet to be determined - m_margin_state.register_block_container_y_position_update_callback([&](CSSPixels margin_top) { + m_margin_state.register_block_container_y_position_update_callback([&, introduce_clearance](CSSPixels margin_top) { if (introduce_clearance == DidIntroduceClearance::No) { place_block_level_element_in_normal_flow_vertically(box, margin_top + y); }