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:
parent
c653b69c75
commit
cd427c746c
3 changed files with 49 additions and 23 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue