mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
2
base
2
base
Submodule base updated: 1c0cf8963b...3ff07f9a05
@@ -69,8 +69,8 @@ end
|
||||
function Cache:insert(key, object)
|
||||
-- guarantee that we have enough memory in cache
|
||||
if(object.size > self.max_memsize) then
|
||||
-- we're not allowed to claim this much at all
|
||||
error("too much memory claimed")
|
||||
DEBUG("too much memory claimed for", key)
|
||||
return
|
||||
end
|
||||
-- delete objects that least recently used
|
||||
-- (they are at the end of the cache_order array)
|
||||
|
||||
@@ -148,9 +148,11 @@ function CreDocument:getCoverPageImage()
|
||||
local data, size = self._document:getCoverPageImageData()
|
||||
if data and size then
|
||||
local Mupdf = require("ffi/mupdf")
|
||||
local image = Mupdf.renderImage(data, size)
|
||||
ffi.C.free(data)
|
||||
return image
|
||||
local ok, image = pcall(Mupdf.renderImage, data, size)
|
||||
if ok then
|
||||
ffi.C.free(data)
|
||||
return image
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user