diff --git a/.changes/fix-fs-scope-deadlock.md b/.changes/fix-fs-scope-deadlock.md new file mode 100644 index 000000000..24d02d9c9 --- /dev/null +++ b/.changes/fix-fs-scope-deadlock.md @@ -0,0 +1,5 @@ +--- +"fs": patch +--- + +Fixes an issue that caused the app to freeze when the `dialog`, `fs`, and `persisted-scope` plugins were used together. diff --git a/plugins/fs/src/scope.rs b/plugins/fs/src/scope.rs index 29852a0d1..f31c786a6 100644 --- a/plugins/fs/src/scope.rs +++ b/plugins/fs/src/scope.rs @@ -55,9 +55,11 @@ impl Scope { pub fn allow_directory>(&self, path: P, recursive: bool) { let path = path.as_ref(); - let mut allowed = self.allowed.lock().unwrap(); - allowed.push(path.to_path_buf()); - allowed.push(path.join(if recursive { "**" } else { "*" })); + { + let mut allowed = self.allowed.lock().unwrap(); + allowed.push(path.to_path_buf()); + allowed.push(path.join(if recursive { "**" } else { "*" })); + } self.emit(Event::PathAllowed(path.to_path_buf())); } @@ -79,9 +81,11 @@ impl Scope { pub fn forbid_directory>(&self, path: P, recursive: bool) { let path = path.as_ref(); - let mut denied = self.denied.lock().unwrap(); - denied.push(path.to_path_buf()); - denied.push(path.join(if recursive { "**" } else { "*" })); + { + let mut denied = self.denied.lock().unwrap(); + denied.push(path.to_path_buf()); + denied.push(path.join(if recursive { "**" } else { "*" })); + } self.emit(Event::PathForbidden(path.to_path_buf())); }