ReaderPaging:onRestoreBookLocation Copy location / ctx so it does not get modified
Some checks failed
macos / macOS 13 x86-64 🔨15.2 🎯10.15 (push) Has been cancelled
macos / macOS 14 ARM64 🔨15.4 🎯11.0 (push) Has been cancelled

Fixes: #13570
This commit is contained in:
yparitcher
2025-04-16 12:31:37 -04:00
parent 92de0759ed
commit 8556d77f55

View File

@@ -599,8 +599,11 @@ function ReaderPaging:onRestoreBookLocation(saved_location)
if not saved_location or not saved_location[1] then
return
end
-- We need a copy, as we will assign this to ReaderView.state
-- which when modified would change our instance on ReaderLink.location_stack
local ctx = util.tableDeepCopy(saved_location)
if self.view.page_scroll then
if self.view:restoreViewContext(saved_location) then
if self.view:restoreViewContext(ctx) then
self:_gotoPage(saved_location[1].page, "scrolling")
else
-- If context is unusable (not from scroll mode), trigger
@@ -615,7 +618,7 @@ function ReaderPaging:onRestoreBookLocation(saved_location)
-- PageUpdate event - so we need to do it for a correct redrawing
local send_PageUpdate = saved_location[1].page == self.current_page
self:_gotoPage(saved_location[1].page)
if not self.view:restoreViewContext(saved_location) then
if not self.view:restoreViewContext(ctx) then
-- If context is unusable (not from page mode), also
-- send PageUpdate event to go to its page and redraw it
send_PageUpdate = true