From 2c44ba3b44ffaacf7246b98a0f4715a0d8c574fe Mon Sep 17 00:00:00 2001 From: Zachary Dremann Date: Mon, 15 Apr 2024 00:08:48 -0400 Subject: [PATCH] fix: race condition when updating parent times Ensure parent directory times are reset before we can possibly say the operation as a whole is complete --- crates/applesauce/src/threads/mod.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/applesauce/src/threads/mod.rs b/crates/applesauce/src/threads/mod.rs index 23d2040..4313f05 100644 --- a/crates/applesauce/src/threads/mod.rs +++ b/crates/applesauce/src/threads/mod.rs @@ -73,11 +73,14 @@ impl Drop for OperationContext { } pub struct Context { + // Fields are dropped in top-down order, so ensure we update the parent's times before + // dropping the operation (which will notify that the operation is done if this is the last + // file). + _parent_reset: Option>, operation: Arc, path: PathBuf, orig_size: u64, progress: Box, - _parent_reset: Option>, } impl Drop for Context {