From 4101b0961bb1f3f6dc14125c7faf64b90b7405a0 Mon Sep 17 00:00:00 2001 From: Mike Fleetwood Date: Fri, 10 May 2019 07:53:52 +0100 Subject: [PATCH] Update file system usage last in prepare_new_partition() (#48) Move setting of the new_partition object file system usage to after everything else, specifically after free_space_before and strict_start. This is because snap_to_*() use free_space_before and strict_start and snap_to_alignment() is going to be called before the file system usage is updated to avoid the error in this bug report. Closes #48 - Error when moving locked LUKS-encrypted partition --- src/Dialog_Base_Partition.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Dialog_Base_Partition.cc b/src/Dialog_Base_Partition.cc index 37a6bc53..c9efec17 100644 --- a/src/Dialog_Base_Partition.cc +++ b/src/Dialog_Base_Partition.cc @@ -220,6 +220,12 @@ void Dialog_Base_Partition::prepare_new_partition() break; } + new_partition->free_space_before = Sector(spinbutton_before.get_value_as_int()) * (MEBIBYTE / new_partition->sector_size); + + // If the original before value has not changed, then set indicator to keep start sector unchanged. + if ( ORIG_BEFORE == spinbutton_before .get_value_as_int() ) + new_partition->strict_start = TRUE; + //update partition usage if ( new_partition->sector_usage_known() ) { @@ -240,12 +246,6 @@ void Dialog_Base_Partition::prepare_new_partition() new_partition->set_sector_usage( new_size, new_size - new_partition->sectors_used ); } } - - new_partition->free_space_before = Sector(spinbutton_before.get_value_as_int()) * (MEBIBYTE / new_partition->sector_size); - - //if the original before value has not changed, then set indicator to keep start sector unchanged - if ( ORIG_BEFORE == spinbutton_before .get_value_as_int() ) - new_partition->strict_start = TRUE; } void Dialog_Base_Partition::Set_Confirm_Button( CONFIRMBUTTON button_type )