[partition] Fixing revert device loop error in PartitionCoreModule::revertAllDevices.

This commit is contained in:
Caio Carvalho 2018-06-11 18:38:57 -03:00
parent 0465cc4214
commit 3b6c764f75

View File

@ -683,7 +683,7 @@ PartitionCoreModule::revertAllDevices()
for ( auto it = m_deviceInfos.begin(); it != m_deviceInfos.end(); ) for ( auto it = m_deviceInfos.begin(); it != m_deviceInfos.end(); )
{ {
// In new VGs device info, there will be always a CreateVolumeGroupJob as the first job in jobs list // In new VGs device info, there will be always a CreateVolumeGroupJob as the first job in jobs list
if ( !( *it )->jobs.empty() ) if ( dynamic_cast<LvmDevice*>( ( *it )->device.data() ) && !( *it )->jobs.empty() )
{ {
CreateVolumeGroupJob* vgJob = dynamic_cast<CreateVolumeGroupJob*>( ( *it )->jobs[0].data() ); CreateVolumeGroupJob* vgJob = dynamic_cast<CreateVolumeGroupJob*>( ( *it )->jobs[0].data() );
@ -697,15 +697,13 @@ PartitionCoreModule::revertAllDevices()
it = m_deviceInfos.erase( it ); it = m_deviceInfos.erase( it );
scanForLVMPVs(); continue;
} }
} }
else
{
revertDevice( ( *it )->device.data() ); revertDevice( ( *it )->device.data() );
++it; ++it;
} }
}
refresh(); refresh();
} }