Fix crash when leaving WireGuard Key screen #1701
Merged
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.
Some crash reports contains an
IllegalStateException
in the WireGuard Key screen. When checking the backtrace, it looked like the view was being updated after the fragment was detached (i.e., after the user left the screen). This shouldn't have happened because the background jobs should be cancelled when leaving the screen.However, it turns out there was a bug in the
JobTracker
. It was cancelling a wrapper "reaper" job instead of cancelling the actual job. This PR fixes that by making sure both jobs are cancelled.Since the crash happened when calling
getResources()
in the fragment for retrieving a color, the PR also takes a second mitigation of caching the color value so that the call isn't necessary anymore.Git checklist:
CHANGELOG.md
under the[Unreleased]
header.This change is