fix: panic when a second zip extract dialog is opened

* Syncs extracted zip files on the compio executor's thread
* Close the first zip extract dialog before opening a new one to fix a panic
---------

Co-authored-by: James A DellaMorte <dellamorte.james@comcast.net>
This commit is contained in:
JADella94 2026-06-24 14:12:10 -04:00 committed by GitHub
parent c653b69c75
commit cd427c746c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 49 additions and 23 deletions

View file

@ -967,11 +967,13 @@ impl Operation {
password,
} => {
let controller_clone = controller.clone();
compio::runtime::spawn_blocking(
move || -> Result<OperationSelection, OperationError> {
compio::runtime::spawn(async move {
let extracted = compio::runtime::spawn_blocking(move || {
let controller = controller_clone;
let total_paths = paths.len();
let mut op_sel = OperationSelection::default();
let mut written_files = Vec::new();
let mut target_dirs = std::collections::HashSet::new();
for (i, path) in paths.iter().enumerate() {
futures::executor::block_on(async {
controller
@ -995,16 +997,32 @@ impl Operation {
op_sel.ignored.push(path.clone());
op_sel.selected.push(new_dir.clone());
crate::archive::extract(path, &new_dir, &password, &controller)?;
let (files, dirs) = crate::archive::extract(
path,
&new_dir,
&password,
&controller,
)?;
written_files.extend(files);
target_dirs.extend(dirs);
}
}
Ok(op_sel)
},
)
Ok::<_, OperationError>((op_sel, written_files, target_dirs))
})
.await
.map_err(wrap_compio_spawn_error)??;
let (op_sel, written_files, target_dirs) = extracted;
if !written_files.is_empty() || !target_dirs.is_empty() {
sync_to_disk(written_files, target_dirs).await;
}
Ok::<_, OperationError>(op_sel)
})
.await
.map_err(wrap_compio_spawn_error)?
}
.await
.map_err(wrap_compio_spawn_error)?,
Self::Move {
paths,
to,