diff options
author | Samuel Holland <samuel@sholland.org> | 2017-08-01 01:38:39 -0500 |
---|---|---|
committer | Samuel Holland <samuel@sholland.org> | 2017-08-01 01:38:39 -0500 |
commit | 5d5cdf54fa0157867e641b37e11d1b89ec26884b (patch) | |
tree | c9fe552530eb3e7d3a98bae8fa2c0f019c458eca /app/src/main/res | |
parent | 874db0b95e8351ce8170b6e9c5a0aa930160ca08 (diff) |
ProfileService: Rework profile updating
This should help discourage editing a Profile without making a copy
first, since the caller has to keep track of the old Profile as well.
ProfileAdder has been updated to prevent adding duplicate profiles. It
checks once in the constructor, so the caller can catch the exception
and pass the error back to the UI. It checks again in the worker thread
to prevent any race from happening if a profile is added twice quickly.
Either the file exists, or it doesn't.
Additionally, this change solves the race condition when the old
profile is removed before it is updated; previously this would lead
to the profile being re-added. Now, ProfileRemover will fail and the
profile will stay removed.
Finally, updating a profile's name should now work correctly. There were
previously multiple bugs with that (the old profile wasn't removed, the
new one could duplicate a name, the new one could overwrite some random
other one, etc.).
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'app/src/main/res')
0 files changed, 0 insertions, 0 deletions