From 862320828ff7af0a66d10ea79ca3c643309298ca Mon Sep 17 00:00:00 2001 From: MacDue Date: Fri, 18 Nov 2022 00:55:02 +0000 Subject: [PATCH] LibWeb: Fix clicking on links Since ff2f31b LibWeb has segfaulted when clicking on links, as the browsing context (a GCPtr) in the lambda was captured by reference and was out of scope by the time the callback fired. --- Userland/Libraries/LibWeb/HTML/HTMLHyperlinkElementUtils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLHyperlinkElementUtils.cpp b/Userland/Libraries/LibWeb/HTML/HTMLHyperlinkElementUtils.cpp index 43858ad2b4..a1b4dcce09 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLHyperlinkElementUtils.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLHyperlinkElementUtils.cpp @@ -534,7 +534,7 @@ void HTMLHyperlinkElementUtils::follow_the_hyperlink(Optional hyperlink_ // set to source. // FIXME: "navigate" means implementing the navigation algorithm here: // https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigate - hyperlink_element_utils_queue_an_element_task(Task::Source::DOMManipulation, [url_string, &target] { + hyperlink_element_utils_queue_an_element_task(Task::Source::DOMManipulation, [url_string, target]() mutable { target->loader().load(url_string, FrameLoader::Type::Navigation); }); }