mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
DocumentRegistry: Downgrade refcount warnings to debug logging.
It can happen in perfectly sane contexts. CReDocument: Don't destroy internal engine data when Document just decreased the refcount (as opposed to actually tore down the document userdata if it were the last ref). PdfDocument: Only write edited documents if the Doc instance was torn down. PicDocument: Silence some DocumentRegistry related warnings
This commit is contained in:
@@ -305,12 +305,20 @@ function CreDocument:_readMetadata()
|
||||
end
|
||||
|
||||
function CreDocument:close()
|
||||
if self.buffer then
|
||||
self.buffer:free()
|
||||
self.buffer = nil
|
||||
end
|
||||
-- Let Document do the refcount check, and tell us if we actually need to tear down the instance.
|
||||
if Document.close(self) then
|
||||
-- Yup, final Document instance, we can safely destroy internal data.
|
||||
-- (Document already took care of our self._document userdata).
|
||||
if self.buffer then
|
||||
self.buffer:free()
|
||||
self.buffer = nil
|
||||
end
|
||||
|
||||
Document.close(self)
|
||||
-- Only exists if the call cache is enabled
|
||||
if self._callCacheDestroy then
|
||||
self._callCacheDestroy()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function CreDocument:updateColorRendering()
|
||||
@@ -1742,12 +1750,6 @@ function CreDocument:setupCallCache()
|
||||
if do_stats then
|
||||
self.close = function(_self)
|
||||
dumpStats()
|
||||
_self._callCacheDestroy()
|
||||
CreDocument.close(_self)
|
||||
end
|
||||
else
|
||||
self.close = function(_self)
|
||||
_self._callCacheDestroy()
|
||||
CreDocument.close(_self)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user