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
This commit is contained in:
Mike Fleetwood 2019-05-10 07:53:52 +01:00 committed by Curtis Gedak
parent 14aa9276d4
commit 4101b0961b
1 changed files with 6 additions and 6 deletions

View File

@ -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 )