mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-11-29 19:52:54 +01:00
Release the clear's lock fully and clear conversion leftovers
The exclusive traffic.lock a launch takes to clear is let go before it is taken shared, since Windows would otherwise hold both. Clearing the blob store also deletes what an interrupted encryption left beside it, so opening doesn't recover the old bodies. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
52d9c9596b
commit
3f3fd15959
2 files changed
+24
-3
No files matched your search
@@ -1484,8 +1484,10 @@ struct ShareOnDrop<'a>(&'a Mutex<Option<std::fs::File>>);
|
||||
impl Drop for ShareOnDrop<'_> {
|
||||
fn drop(&mut self) {
|
||||
let held = self.0.lock().unwrap_or_else(PoisonError::into_inner);
|
||||
// Let go first: Windows would otherwise add the shared lock beside the exclusive one.
|
||||
// Unix's flock lets go between the two as well, so this is no wider a gap.
|
||||
if let Some(file) = held.as_ref()
|
||||
&& let Err(e) = file.lock_shared()
|
||||
&& let Err(e) = file.unlock().and_then(|()| file.lock_shared())
|
||||
{
|
||||
warn!("Failed to share {TRAFFIC_LOCK}: {e}");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user