From ab923121defaaf847225c772e68ed11ab7377ad1 Mon Sep 17 00:00:00 2001 From: Mike Fleetwood Date: Sun, 15 May 2016 18:09:31 +0100 Subject: [PATCH] Replace whole path list after calibrate in apply_operation_to_disk() (#766349) When replacing the list of paths for the other partition object involved in either a Resize/Move or Format operation in apply_operation_to_disk() should replace the whole list of partitions not just replace with the first path. Copy the whole path list is the correct action. It makes no material difference because secondary partition paths are only used to discover mount points during refresh phase and not at the apply phase, where only the primary path is used. Bug 766349 - Resolve code ugliness with partition path getting set to "copy of /dev/SRC" --- src/GParted_Core.cc | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc index 35d3168d..bc5a355a 100644 --- a/src/GParted_Core.cc +++ b/src/GParted_Core.cc @@ -758,9 +758,12 @@ bool GParted_Core::apply_operation_to_disk( Operation * operation ) if ( ! success ) break; - // Reset the new partition object's real path in case the name is - // "copy of ..." from the previous operation. - operation->get_partition_new().add_path( operation->get_partition_original().get_path(), true ); + // Replace the new partition object's list of paths from the + // calibration in case the first path is "Copy of ..." from the + // partition having been newly created by a paste into unallocated + // space earlier in the sequence of operations now being applied. + operation->get_partition_new().add_paths( operation->get_partition_original().get_paths(), + true ); success = resize_move( operation->get_partition_original(), operation->get_partition_new(), @@ -772,9 +775,12 @@ bool GParted_Core::apply_operation_to_disk( Operation * operation ) if ( ! success ) break; - // Reset the original partition object's real path in case the - // name is "copy of ..." from the previous operation. - operation->get_partition_original().add_path( operation->get_partition_new().get_path(), true ); + // Replace the original partition object's list of paths from the + // calibration in case the first path is "Copy of ..." from the + // partition having been newly created by a paste into unallocated + // space earlier in the sequence of operations now being applied. + operation->get_partition_original().add_paths( operation->get_partition_new().get_paths(), + true ); success = remove_filesystem( operation->get_partition_original(), operation->operation_detail )