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:
@@ -214,6 +214,7 @@ function DocumentRegistry:openDocument(file, provider)
|
||||
end
|
||||
else
|
||||
self.registry[file].refs = self.registry[file].refs + 1
|
||||
logger.dbg("DocumentRegistry: Increased refcount to", self.registry[file].refs, "for", file)
|
||||
end
|
||||
if self.registry[file] then
|
||||
return self.registry[file].doc
|
||||
@@ -232,7 +233,16 @@ function DocumentRegistry:closeDocument(file)
|
||||
return self.registry[file].refs
|
||||
end
|
||||
else
|
||||
error("Try to close unregistered file.")
|
||||
error("Tried to close an unregistered file.")
|
||||
end
|
||||
end
|
||||
|
||||
--- Queries the current refcount for a given file
|
||||
function DocumentRegistry:getReferenceCount(file)
|
||||
if self.registry[file] then
|
||||
return self.registry[file].refs
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user