LibWeb: Remove some uses of [&] lambda captures for queued tasks

Using a default reference capture for these kinds of tasks is dangerous
and prone to error. Some of the variables should for sure be captured
by value so that we can keep a GC object alive rather than trying to
refer to stack objects.
This commit is contained in:
Andrew Kaster 2024-12-09 19:48:50 -07:00 committed by Andreas Kling
parent 6ed2bf2bb1
commit 66519af43f
Notes: github-actions[bot] 2024-12-10 06:14:03 +00:00
4 changed files with 10 additions and 10 deletions

View file

@ -352,8 +352,8 @@ WebIDL::ExceptionOr<GC::Ref<WebIDL::Promise>> HTMLImageElement::decode() const
// 3. Otherwise, in parallel wait for one of the following cases to occur, and perform the corresponding actions:
Platform::EventLoopPlugin::the().deferred_invoke(GC::create_function(heap(), [this, promise, &realm, &global] {
Platform::EventLoopPlugin::the().spin_until(GC::create_function(heap(), [&] {
auto queue_reject_task = [&](String const& message) {
Platform::EventLoopPlugin::the().spin_until(GC::create_function(heap(), [this, promise, &realm, &global] {
auto queue_reject_task = [promise, &realm, &global](String const& message) {
queue_global_task(Task::Source::DOMManipulation, global, GC::create_function(realm.heap(), [&realm, promise, message = String(message)] {
auto exception = WebIDL::EncodingError::create(realm, message);
HTML::TemporaryExecutionContext context(realm);