Fix crash when trying to delete an extended partition
This commit is contained in:
parent
568dc4db0a
commit
3fa3694f90
@ -23,6 +23,7 @@
|
|||||||
#include <DeletePartitionJob.h>
|
#include <DeletePartitionJob.h>
|
||||||
#include <DeviceModel.h>
|
#include <DeviceModel.h>
|
||||||
#include <PartitionModel.h>
|
#include <PartitionModel.h>
|
||||||
|
#include <PMUtils.h>
|
||||||
#include <Typedefs.h>
|
#include <Typedefs.h>
|
||||||
#include <utils/Logger.h>
|
#include <utils/Logger.h>
|
||||||
|
|
||||||
@ -176,6 +177,19 @@ PartitionCoreModule::deletePartition( Device* device, Partition* partition )
|
|||||||
|
|
||||||
if ( partition->state() == Partition::StateNew )
|
if ( partition->state() == Partition::StateNew )
|
||||||
{
|
{
|
||||||
|
if ( partition->roles().has( PartitionRole::Extended ) )
|
||||||
|
{
|
||||||
|
// Delete all logical partitions first
|
||||||
|
// I am not sure if we can iterate on Partition::children() while
|
||||||
|
// deleting them, so let's play it safe and keep our own list.
|
||||||
|
QList< Partition* > lst;
|
||||||
|
for ( auto partition : partition->children() )
|
||||||
|
if ( !PMUtils::isPartitionFreeSpace( partition ) )
|
||||||
|
lst << partition;
|
||||||
|
|
||||||
|
for ( auto partition : lst )
|
||||||
|
deletePartition( device, partition );
|
||||||
|
}
|
||||||
// Find matching CreatePartitionJob
|
// Find matching CreatePartitionJob
|
||||||
auto it = std::find_if( jobs.begin(), jobs.end(), [ partition ]( Calamares::job_ptr job )
|
auto it = std::find_if( jobs.begin(), jobs.end(), [ partition ]( Calamares::job_ptr job )
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user