LibWeb+Assistant: Do not ref-capture stack vars in deferred lambdas

This commit is contained in:
Matthew Olsson 2024-04-07 16:30:15 -07:00 committed by Andreas Kling
parent 76fa127cbf
commit 31c5cdcbd5
2 changed files with 2 additions and 2 deletions

View file

@ -258,7 +258,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
} }
mark_selected_item(); 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) { db.on_new_results = [&](auto results) {

View file

@ -664,7 +664,7 @@ void BlockFormattingContext::layout_block_level_box(Box const& box, BlockContain
m_margin_state.reset(); m_margin_state.reset();
} else if (!m_margin_state.has_block_container_waiting_for_final_y_position()) { } 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 // 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) { if (introduce_clearance == DidIntroduceClearance::No) {
place_block_level_element_in_normal_flow_vertically(box, margin_top + y); place_block_level_element_in_normal_flow_vertically(box, margin_top + y);
} }