From 487e5f667a1df3628afd40eb1647da217ecaba40 Mon Sep 17 00:00:00 2001 From: poire-z Date: Mon, 15 Jan 2024 16:30:12 +0100 Subject: [PATCH] ReaderThumbnail: prevent standby during thumbnails generation PageBrowser could have strange issues on devices with aggressive autostandby (ie. failure to read data from subprocess). --- frontend/apps/reader/modules/readerthumbnail.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/frontend/apps/reader/modules/readerthumbnail.lua b/frontend/apps/reader/modules/readerthumbnail.lua index 14d422a54..e29c13562 100644 --- a/frontend/apps/reader/modules/readerthumbnail.lua +++ b/frontend/apps/reader/modules/readerthumbnail.lua @@ -278,6 +278,10 @@ function ReaderThumbnail:getPageThumbnail(page, width, height, batch_id, when_ge end function ReaderThumbnail:ensureTileGeneration() + if not self._standby_prevented then + self._standby_prevented = true + UIManager:preventStandby() + end local has_pids_still_to_collect = self:collectPids() local still_in_progress = false @@ -318,6 +322,11 @@ function ReaderThumbnail:ensureTileGeneration() end if self.req_in_progress or has_pids_still_to_collect or next(self.thumbnails_requests) then self._ensureTileGeneration_action() + else + if self._standby_prevented then + self._standby_prevented = false + UIManager:allowStandby() + end end end @@ -513,6 +522,10 @@ function ReaderThumbnail:onCloseDocument() self.tile_cache:clear() self.tile_cache = nil end + if self._standby_prevented then + self._standby_prevented = false + UIManager:allowStandby() + end end function ReaderThumbnail:onColorRenderingUpdate()