Fix visually re-applying copy new operation in create-copy-grow-first sequence (#755214)
This is the equivalent case fixed in the earlier commit, but now using copy/paste to create the second new partition rather than plain new. Fix visually re-apply create operation in create-create-grow-first sequence (#755214) Start with an existing partition as a copy source. Then this sequence of operations will cause the copy partition to disappear from the disk graphic: 1) create new #1, 2) copy existing / paste into unallocated leaving space preceding, 3) resize new #1 larger. There are two different types of copy operation. The first is copy into unallocated space creating a new partition which needs treating the same as create new operation. The second is copy into existing partition which needs treating the same as the other operations which don't change the boundaries of the partition. Fix apply_to_visual() accordingly. Bug 755214 - Refactor operation merging
This commit is contained in:
parent
dc6ffc6a87
commit
0e8f24b92b
|
@ -38,37 +38,12 @@ OperationCopy::OperationCopy( const Device & device,
|
||||||
|
|
||||||
void OperationCopy::apply_to_visual( std::vector<Partition> & partitions )
|
void OperationCopy::apply_to_visual( std::vector<Partition> & partitions )
|
||||||
{
|
{
|
||||||
index = index_extended = -1 ;
|
if ( partition_original.type == TYPE_UNALLOCATED )
|
||||||
|
// Paste into unallocated space creating new partition
|
||||||
if ( partition_original .inside_extended )
|
insert_new( partitions );
|
||||||
{
|
|
||||||
index_extended = find_index_extended( partitions ) ;
|
|
||||||
|
|
||||||
if ( index_extended >= 0 )
|
|
||||||
index = find_index_original( partitions[ index_extended ] .logicals ) ;
|
|
||||||
|
|
||||||
if ( index >= 0 )
|
|
||||||
{
|
|
||||||
partitions[ index_extended ] .logicals[ index ] = partition_new ;
|
|
||||||
|
|
||||||
insert_unallocated( partitions[ index_extended ] .logicals,
|
|
||||||
partitions[ index_extended ] .sector_start,
|
|
||||||
partitions[ index_extended ] .sector_end,
|
|
||||||
device .sector_size,
|
|
||||||
true ) ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
// Paste into existing partition
|
||||||
index = find_index_original( partitions ) ;
|
substitute_new( partitions );
|
||||||
|
|
||||||
if ( index >= 0 )
|
|
||||||
{
|
|
||||||
partitions[ index ] = partition_new ;
|
|
||||||
|
|
||||||
insert_unallocated( partitions, 0, device .length -1, device .sector_size, false ) ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OperationCopy::create_description()
|
void OperationCopy::create_description()
|
||||||
|
|
Loading…
Reference in New Issue