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:
NiLuJe committed 2021-05-21 01:58:00 +02:00
1 parent 7dea979ef4
commit 2c4cbd12a2
6 files changed
+48 -19

No files matched your search

+9 -2
View File
@@ -261,9 +261,16 @@ function PdfDocument:writeDocument()
end
function PdfDocument:close()
if self.is_edited then
self:writeDocument()
-- NOTE: We can't just rely on Document:close's return code for that, as we need self._document
-- in :writeDocument, and it would have been destroyed.
local DocumentRegistry = require("document/documentregistry")
if DocumentRegistry:getReferenceCount(self.file) == 1 then
-- We're the final reference to this Document instance.
if self.is_edited then
self:writeDocument()
end
end
Document.close(self)
end