1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 10:55:06 +00:00

LibWeb: Fix "stack-use-after-return" in navigate_to_a_fragmement()

Callback running on the session history queue should capture necessary
pointers by value instead of reference, because navigate_to_a_fragment
stack will have been destroyed by the time it will be executed.
This commit is contained in:
Aliaksandr Kalenik 2023-08-25 00:27:45 +02:00 committed by Andreas Kling
parent 23569f8690
commit 15d265da65

View file

@ -1095,7 +1095,7 @@ WebIDL::ExceptionOr<void> Navigable::navigate_to_a_fragment(AK::URL const& url,
auto traversable = traversable_navigable();
// 17. Append the following session history synchronous navigation steps involving navigable to traversable:
traversable->append_session_history_traversal_steps([&] {
traversable->append_session_history_traversal_steps([this, traversable, history_entry, entry_to_replace] {
// 1. Finalize a same-document navigation given traversable, navigable, historyEntry, and entryToReplace.
finalize_a_same_document_navigation(*traversable, *this, history_entry, entry_to_replace);