mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-03 04:52:06 +02:00
LibWeb: Remove tasks for destroyed documents when filtering on tasks
In TaskQueue::take_tasks_matching(), we were not discarding tasks for
destroyed documents as we now do in ::take_first_runnable() since commit
c8baa6e179.
This fixes some occurrences of missing browsing contexts / active
documents in TraversableNavigable::destroy_top_level_traversable().
This commit is contained in:
committed by
Andreas Kling
parent
eb293197f7
commit
624d514f47
Notes:
github-actions[bot]
2026-03-22 19:27:57 +00:00
Author: https://github.com/gmta Commit: https://github.com/LadybirdBrowser/ladybird/commit/624d514f479 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8570
@@ -52,8 +52,7 @@ GC::Ptr<Task> TaskQueue::take_first_runnable()
|
||||
if (m_tasks[i]->is_runnable())
|
||||
return m_tasks.take(i);
|
||||
|
||||
// A non-runnable task with a destroyed document will never become runnable again; remove it.
|
||||
if (m_tasks[i]->document() && m_tasks[i]->document()->has_been_destroyed()) {
|
||||
if (m_tasks[i]->is_permanently_unrunnable()) {
|
||||
m_tasks.remove(i);
|
||||
continue;
|
||||
}
|
||||
@@ -91,6 +90,11 @@ GC::RootVector<GC::Ref<Task>> TaskQueue::take_tasks_matching(Function<bool(HTML:
|
||||
for (size_t i = 0; i < m_tasks.size();) {
|
||||
auto& task = m_tasks.at(i);
|
||||
|
||||
if (task->is_permanently_unrunnable()) {
|
||||
m_tasks.remove(i);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (filter(*task)) {
|
||||
matching_tasks.append(task);
|
||||
m_tasks.remove(i);
|
||||
|
||||
Reference in New Issue
Block a user