forked from chenxiaolong/BCR
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RecordRulesViewModel: Fix race condition when mutating rules
BCR can potentially be unloaded from memory when the user is in Android's contact picker activity. If this happens, when they return, the coroutines in refreshRules() and addContactRule() may execute at the same time. This does not cause crashes due to MutableStateFlow's compare and set behavior, but does cause weird behavior, like the new contact rule being added to an empty list of rules. Fixes: chenxiaolong#554 Signed-off-by: Andrew Gunnerson <[email protected]>
- Loading branch information
1 parent
304395d
commit 2a7aee2
Showing
1 changed file
with
76 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters