Skip to content

ReaderRolling: Guard against races between scheduled tasks and CloseDocument #10934

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

Merged
merged 3 commits into from
Sep 23, 2023

Conversation

NiLuJe
Copy link
Member

@NiLuJe NiLuJe commented Sep 22, 2023

Fix #10932


This change is Reviewable

@NiLuJe NiLuJe added this to the 2023.09 milestone Sep 22, 2023
@NiLuJe
Copy link
Member Author

NiLuJe commented Sep 22, 2023

(Ping @poire-z for when he gets back ;)).

Easy enough to avoid here, so, dooooooo iiiiitttttt!
Comment on lines -1090 to +1105
UIManager:scheduleIn(0.1, function ()
self:onCheckDomStyleCoherence()
end)
UIManager:scheduleIn(0.1, self.onCheckDomStyleCoherence, self)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer the readability of the one with the function() wrapper - and for consistency with the others that may do just a bit more, like in your next chunk.

Copy link
Member Author

@NiLuJe NiLuJe Sep 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It usually depends on my mood, but avoiding a closure here means we can easily unschedule it without storing a reference to the scheduled closure, so it's very much on purpose there (to get a simple, stable reference to the scheduled function).

(I'm not necessarily a fan of doing the guarding inside the closure like some of them do, for instance).

Copy link
Contributor

@poire-z poire-z left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing against.

Co-authored-by: Frans de Jonge <fransdejonge@gmail.com>
@NiLuJe NiLuJe merged commit e5535a3 into koreader:master Sep 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Timesync and wifi issue
3 participants