mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 17:28:30 +00:00
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:
committed by
Andreas Kling
parent
6ed2bf2bb1
commit
66519af43f
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user