mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
_checkTasks first get number of tasks in the stack and does a numeric for loop to go through each task. The problem is a task might call schedule or unschedule, which will reorder tasks in the stack. This will invalidate many of the table indexes used in the for loop. This patch turns the task stack into an ordered queue, so _checkTasks only pops one item out of the queue each time instead of setting up a for loop at the beginning. This should avoid the race condition mentioned above.