Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This logic was over-complicated and caused multiple bugs. This hopefully remediates to this for good. Fixes #1196.
I finally took the time to look at the timer logic of the
run
function, check what was actually needed, and came up with this simplification. I tried to document it in the function, feedback welcome :)This passes
make test
correctly:Issue #1196 is also fixed: I tried manually the scenarios I could think of (including the one mentioned in the issue) and could not get a
Source ID xx was not found
error.Note for the future: replacing
g_timeout_add
withg_timeout_add_once
would enhance robustness, in case a bug causes two timers to be running concurrently — which would double the number of invocations ofrun
unnecessarily, until no notifications are shown for a time, and could exponentially blow-up if the bug occurs within the bug. However, this function was introduced in GLib 2.74, which is too recent for eg. Debian Bullseye.