mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
ReaderPaging:onRestoreBookLocation Copy location / ctx so it does not get modified
Fixes: #13570
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user