-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Widgets: Unschedule timeouts on early close #11126
Conversation
Affects Notification, InfoMessage & QRMessage Mostly harmless in practice, except for InfoMessage with a dismiss_callback, as it would have effectively ran twice.
Noticed while testing #11122 (as it effectively allows you to dismiss the "Disabled input" notification early, and I wanted to check that it didn't screw up the expected state after that). |
Scratch that, the callback kills itself on exec ;o). So, mostly harmless, except for confusing logs ;p. |
Methinks it should simply attempt to run it |
(I'm relatively confident it would be mostly harmless, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 3 of 3 files at r1, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @NiLuJe)
(InfoMessage *should* follow the same pattern, but Trapper does naughty timing-sensitive stuff with it that I don't really know how to test). Fun fact: nothing in the current codebase actually sets a dismiss_callback on a QRMessage ;p.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @NiLuJe)
Looks like no change to me :) I don't see how these changes could affect anything. |
Also minor fixup to previous change, make sure we drop the scheduled timeout even when invisible or no_refresh_on_close
Yeah, because they were theoretical ^^. See 160840a for what I meant ;). |
Nip the refs early
Ok :) Well, I don't see (haven't tested though) how this moving things around could have any impact on Trapper. Just save some Wikipedia as epub with images, or refresh cached book info, and tap at some point to check all is good. Also, may be do the unschedule first/early before calling any dismiss_callback? |
I had a similar thought last night, but since we're still inside the same UI frame, I don't think there's a way it could matter? What did you have in mind? |
Scrolling a "full" Wikipedia lookup with images seems to behave, as does cancelling the high-res asset download on long-pressing an image. |
Nothing specific. I also had the same thought as it all being in the same "frame" (that is: only this runs sequentially, nothing else can happen in between), but just for visual consitency :) and so we don't have to wonder if anything can happen in a dismiss_callback that would take a long time.
The things in Trapper that use the InfoMesage are the dialog driven parts, not used but what you tried, but used by the things I mentionned :) |
Oh, the actual download process, now I remember ;p. |
Interrupting the download works inasmuch as I get the dialog with the choice to Continue or Abort, but choosing Continue always leads to (immediate) failure: "Saving Wikipedia article failed or interrupted" (without the previous cleanup notice that shows up for abort). On the "upside", this also happens on master, so, yay? :D |
Oh, sh*t .... what broke that? :/
It was already broken in v2022.07. And in v2021.06. And in v2020.06. And in v2020.02-12. (I don't have any nightly older that than.) |
I don't think I've tested interrupting in… quite a while. |
This avoids the crash - but have the dismiss stuff work only once: --- a/frontend/ui/trapper.lua
+++ b/frontend/ui/trapper.lua
@@ -172,24 +172,25 @@ function Trapper:info(text, fast_refresh)
UIManager:show(abort_box)
-- no need to forceRePaint, UIManager will do it when we yield()
go_on = coroutine.yield() -- abort_box ok/cancel from their coroutine.resume()
UIManager:close(abort_box)
if not go_on then
UIManager:close(self.current_widget)
UIManager:forceRePaint()
return false
end
if self.current_widget then
-- Re-show current widget that was dismissed
-- (this is fine for our simple InfoMessage)
+ self.current_widget:init()
UIManager:show(self.current_widget)
end
UIManager:forceRePaint()
end
-- go_on_func returned result = true, or abort_box did not abort:
-- continue processing
end ( I guess the comment above the line I added is no longer true :) and since then, InfoMessage, when dismissed, has been properly freed on close - and just showing again that dead one failed. |
Yeah, I was assuming it was due to lifecycle fixes ;). I'm not familiar with the code, but it's probably easier to just sniff the last (Or do something awful that returns a new widget instance based on the current one... somewhere. e.g., |
Or just add another flag to InfoMessage, |
Hmm, yeah, Trapper holds a reference to it. I'll see if moving the "destructive" cleanup to a separate method and simply NOP-ing (or tweaking) that one for Trapper widgets does the job. |
Last commit seems to fix the Wikipedia case, but I wouldn't bet money on everything being quite up to snuff ;p. |
Too late for me to, so please check how it does with "Refresh cached book info" on a big dir where you'll get some long filenames that will make the InfoMessage grow to 2 lines, and how it is after you interrupt and "Continue" it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 3 files at r4, 2 of 2 files at r6, 1 of 1 files at r7, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @NiLuJe)
Hard to tell as I don't really have long filenames (hai, calibre ;p), but at least it works and doesn't do something obviously broken ;). |
AFAICT, interrupting a larger than one line IM does resume a properly sized (i.e., larger) IM. |
Tested this PR on my Kobo, and for the Wikipedia Save as EPUB and Refresh cached book info, it behaves as I remember it did. So, good for me, thanks :) |
Affects Notification, InfoMessage & QRMessage
Mostly harmless in practice, except for InfoMessage with a dismiss_callback, as it would have effectively ran twice.
This change is