CanvasContext.hasEinkScreen(): avoid crash on Android (#9417)

It is used by CoverBrowser, in a subprocess, when extracting
metadata from PicDocuments, and crash on Android as calling
android methods is only allowed from the main thread.
This commit is contained in:
poire-z
2022-08-08 11:42:56 +02:00
committed by GitHub
parent d98fa04d13
commit 55c0fc6190

View File

@@ -52,7 +52,11 @@ function CanvasContext:init(device)
Mupdf.bgr = true
end
self.hasEinkScreen = device.hasEinkScreen
-- This one may be called by a subprocess, and would crash on Android when
-- calling android.isEink() which is only allowed from the main thread.
local hasEinkScreen = device.hasEinkScreen()
self.hasEinkScreen = function() return hasEinkScreen end
self.canHWDither = device.canHWDither
self.fb_bpp = device.screen.fb_bpp
end