From d1bbdb5dad836c3f838b75215f0fae1f81d3a6a6 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Sat, 19 Aug 2023 13:22:22 +0200 Subject: [PATCH] PocketBook: Run Generic:exit *last* Makes more sense this way. Re: #10828 Also clarify the UIManager "no dialogs left" message, and drop the return value, as it's meaningless, we just want to break & return. --- frontend/device/pocketbook/device.lua | 12 ++++++------ frontend/ui/uimanager.lua | 5 +++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/frontend/device/pocketbook/device.lua b/frontend/device/pocketbook/device.lua index bb8f38065..0d8064b73 100644 --- a/frontend/device/pocketbook/device.lua +++ b/frontend/device/pocketbook/device.lua @@ -257,18 +257,18 @@ function PocketBook:init() end function PocketBook:exit() - Generic.exit(self) - -- Exit code can be shoddy on some devices due to broken library dtors calling _exit(0) from os.exit(N) local ko_exit = os.getenv("KO_EXIT_CODE") if ko_exit then - local fo = io.open(ko_exit, "w+") - if fo then + local f = io.open(ko_exit, "w+") + if f then -- As returned by UIManager:run() in reader.lua - fo:write(tostring(UIManager._exit_code)) - fo:close() + f:write(tostring(UIManager._exit_code)) + f:close() end end + + Generic.exit(self) end function PocketBook:notifyBookState(title, document) diff --git a/frontend/ui/uimanager.lua b/frontend/ui/uimanager.lua index 57c849438..d0fc949a6 100644 --- a/frontend/ui/uimanager.lua +++ b/frontend/ui/uimanager.lua @@ -39,6 +39,7 @@ local UIManager = { _refresh_func_stack = {}, _entered_poweroff_stage = false, _exit_code = nil, + _gated_quit = nil, _prevent_standby_count = 0, _prev_prevent_standby_count = 0, @@ -1448,9 +1449,9 @@ function UIManager:handleInput() -- stop when we have no window to show if not self._window_stack[1] then - logger.info("no dialog left to show") + logger.info("UIManager: No dialogs left to show") if self:_gated_quit() ~= false then - return nil + return end end