Finally no race conds

This commit is contained in:
Ward from fusion-voyager-3 2024-08-20 15:19:07 +00:00
parent e4a605915d
commit cae58cb750

View File

@ -240,7 +240,7 @@ pub fn create_efi_row(
move |row: DriveMountRow| { move |row: DriveMountRow| {
listbox.remove(&row); listbox.remove(&row);
(*used_partition_array_refcell.borrow_mut()) (*used_partition_array_refcell.borrow_mut())
.retain(|x| &x.partition.part_name != &row.partition()); .retain(|x| x.used_by != row.id());
partition_changed_action.activate(Some( partition_changed_action.activate(Some(
&glib::variant::Variant::from_data_with_type( &glib::variant::Variant::from_data_with_type(
row.id().to_string(), row.id().to_string(),
@ -472,7 +472,7 @@ pub fn create_boot_row(
move |row: DriveMountRow| { move |row: DriveMountRow| {
listbox.remove(&row); listbox.remove(&row);
(*used_partition_array_refcell.borrow_mut()) (*used_partition_array_refcell.borrow_mut())
.retain(|x| &x.partition.part_name != &row.partition()); .retain(|x| x.used_by != row.id());
partition_changed_action.activate(Some( partition_changed_action.activate(Some(
&glib::variant::Variant::from_data_with_type( &glib::variant::Variant::from_data_with_type(
row.id().to_string(), row.id().to_string(),
@ -709,7 +709,7 @@ pub fn create_root_row(
move |row: DriveMountRow| { move |row: DriveMountRow| {
listbox.remove(&row); listbox.remove(&row);
(*used_partition_array_refcell.borrow_mut()) (*used_partition_array_refcell.borrow_mut())
.retain(|x| &x.partition.part_name != &row.partition()); .retain(|x| x.used_by != row.id());
partition_changed_action.activate(Some( partition_changed_action.activate(Some(
&glib::variant::Variant::from_data_with_type( &glib::variant::Variant::from_data_with_type(
row.id().to_string(), row.id().to_string(),
@ -910,7 +910,7 @@ pub fn create_mount_row(
move |row: DriveMountRow| { move |row: DriveMountRow| {
listbox.remove(&row); listbox.remove(&row);
(*used_partition_array_refcell.borrow_mut()) (*used_partition_array_refcell.borrow_mut())
.retain(|x| &x.partition.part_name != &row.partition()); .retain(|x| x.used_by != row.id());
partition_changed_action.activate(Some( partition_changed_action.activate(Some(
&glib::variant::Variant::from_data_with_type( &glib::variant::Variant::from_data_with_type(
row.id().to_string(), row.id().to_string(),
@ -989,7 +989,7 @@ fn post_check_drive_mount(
} }
} else { } else {
(*used_partition_array_refcell.borrow_mut()) (*used_partition_array_refcell.borrow_mut())
.retain(|x| &x.partition.part_name != &row.partition()); .retain(|x| x.used_by != row.id());
} }
partition_changed_action.activate(Some( partition_changed_action.activate(Some(
&glib::variant::Variant::from_data_with_type( &glib::variant::Variant::from_data_with_type(
@ -1009,6 +1009,12 @@ fn post_check_drive_mount(
#[strong] #[strong]
null_checkbutton, null_checkbutton,
#[strong] #[strong]
null_checkbutton,
#[strong]
used_partition_array_refcell,
#[strong]
partition_changed_action,
#[strong]
partition, partition,
#[strong] #[strong]
row, row,
@ -1024,7 +1030,15 @@ fn post_check_drive_mount(
} }
} else { } else {
(*partition_row_struct.swap_fs_error.borrow_mut()) = true; (*partition_row_struct.swap_fs_error.borrow_mut()) = true;
(*used_partition_array_refcell.borrow_mut()).retain(|x| x.used_by != row.id());
null_checkbutton.set_active(true); null_checkbutton.set_active(true);
row.set_partition("");
partition_changed_action.activate(Some(
&glib::variant::Variant::from_data_with_type(
row.id().to_string(),
glib::VariantTy::STRING,
),
));
partition_row_struct.widget.set_sensitive(false); partition_row_struct.widget.set_sensitive(false);
} }
} else { } else {