Merge pull request #1030 from chrox/fix_1028

fix #1028
This commit is contained in:
Qingping Hou
2014-10-23 03:14:05 -04:00
3 changed files with 8 additions and 6 deletions

2
base

Submodule base updated: 1c0cf8963b...3ff07f9a05

View File

@@ -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)

View File

@@ -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