mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Deal with table.pack corner-cases properly (#10350)
c.f., https://github.com/koreader/koreader-base/pull/1603 for more details. Re: #9624
This commit is contained in:
@@ -361,7 +361,7 @@ function UIManager:debounce(seconds, immediate, action)
|
||||
else
|
||||
is_scheduled = false
|
||||
if not immediate then
|
||||
result = action(unpack(args))
|
||||
result = action(unpack(args, 1, args.n))
|
||||
end
|
||||
if not is_scheduled then
|
||||
-- This check is needed because action can recursively call debounced_action_wrapper
|
||||
@@ -376,7 +376,7 @@ function UIManager:debounce(seconds, immediate, action)
|
||||
self:scheduleIn(seconds, scheduled_action)
|
||||
is_scheduled = true
|
||||
if immediate then
|
||||
result = action(unpack(args))
|
||||
result = action(unpack(args, 1, args.n))
|
||||
end
|
||||
end
|
||||
return result
|
||||
@@ -987,7 +987,7 @@ function UIManager:_checkTasks()
|
||||
-- NOTE: Said task's action might modify _task_queue.
|
||||
-- To avoid race conditions and catch new upcoming tasks during this call,
|
||||
-- we repeatedly check the head of the queue (c.f., #1758).
|
||||
task.action(unpack(task.args))
|
||||
task.action(unpack(task.args, 1, task.args.n))
|
||||
else
|
||||
-- As the queue is sorted in descending order, it's safe to assume all items are currently future tasks.
|
||||
wait_until = task_time
|
||||
|
||||
Reference in New Issue
Block a user