diff --git a/frontend/apps/reader/modules/readerback.lua b/frontend/apps/reader/modules/readerback.lua index b3289d240..c5dd6eb43 100644 --- a/frontend/apps/reader/modules/readerback.lua +++ b/frontend/apps/reader/modules/readerback.lua @@ -32,16 +32,7 @@ end function ReaderBack:_getCurrentLocation() if self.ui.document.info.has_pages then - local current_location = self.ui.paging:getBookLocation() - if current_location then - -- We need a copy, as we're getting references to - -- objects ReaderPaging/ReaderView may still modify - local res = {} - for i=1, #current_location do - res[i] = util.tableDeepCopy(current_location[i]) - end - return res - end + return self.ui.paging:getBookLocation() else return { xpointer = self.ui.rolling:getBookLocation(), diff --git a/frontend/apps/reader/modules/readerpaging.lua b/frontend/apps/reader/modules/readerpaging.lua index 5b18204df..b61cececf 100644 --- a/frontend/apps/reader/modules/readerpaging.lua +++ b/frontend/apps/reader/modules/readerpaging.lua @@ -11,6 +11,7 @@ local TimeVal = require("ui/timeval") local UIManager = require("ui/uimanager") local bit = require("bit") local logger = require("logger") +local util = require("util") local _ = require("gettext") local Input = Device.input local Screen = Device.screen @@ -683,8 +684,18 @@ function ReaderPaging:onPanningRel(diff) return true end +-- Used by ReaderBack & ReaderLink. function ReaderPaging:getBookLocation() - return self.view:getViewContext() + local ctx = self.view:getViewContext() + if ctx then + -- We need a copy, as we're getting references to + -- objects ReaderPaging/ReaderView may still modify + local current_location = {} + for i=1, #ctx do + current_location[i] = util.tableDeepCopy(ctx[i]) + end + return current_location + end end function ReaderPaging:onRestoreBookLocation(saved_location)