mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 21:29:06 +00:00
LibWeb: Skip SHTQ processing if ongoing task form queue is not finished
Fixes a bug when session history traversal queue task could be interrupted by another SHTQ task execution. For example: 1. SHTQ timer callback starts executing a task from the queue. 2. spin_until() is invoked during task execution. 3. SHTQ timer callback starts executing a task from the queue.
This commit is contained in:
parent
00531573a4
commit
4ca715d2ef
Notes:
sideshowbarker
2024-07-17 06:51:10 +09:00
Author: https://github.com/kalenikaliaksandr
Commit: 4ca715d2ef
Pull-request: https://github.com/SerenityOS/serenity/pull/23853
1 changed files with 7 additions and 0 deletions
|
@ -25,9 +25,15 @@ public:
|
|||
SessionHistoryTraversalQueue()
|
||||
{
|
||||
m_timer = Core::Timer::create_single_shot(0, [this] {
|
||||
if (m_is_task_running && m_queue.size() > 0) {
|
||||
m_timer->start();
|
||||
return;
|
||||
}
|
||||
while (m_queue.size() > 0) {
|
||||
m_is_task_running = true;
|
||||
auto entry = m_queue.take_first();
|
||||
entry.steps();
|
||||
m_is_task_running = false;
|
||||
}
|
||||
}).release_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
@ -60,6 +66,7 @@ public:
|
|||
private:
|
||||
Vector<SessionHistoryTraversalQueueEntry> m_queue;
|
||||
RefPtr<Core::Timer> m_timer;
|
||||
bool m_is_task_running { false };
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue