updatePartitionToCreate: avoid crash

Create the new partition before deleting the old one: otherwise the
m_partition member of dlg is dangling at the time we call createPartition()
This commit is contained in:
Aurélien Gâteau 2014-08-04 19:23:39 +02:00
parent 3d40527d29
commit e482481262

View File

@ -216,8 +216,9 @@ PartitionPage::updatePartitionToCreate( Device* device, Partition* partition )
dlg->initFromPartitionToCreate( partition ); dlg->initFromPartitionToCreate( partition );
if ( dlg->exec() == QDialog::Accepted ) if ( dlg->exec() == QDialog::Accepted )
{ {
Partition* newPartition = dlg->createPartition();
m_core->deletePartition( device, partition ); m_core->deletePartition( device, partition );
m_core->createPartition( device, dlg->createPartition() ); m_core->createPartition( device, newPartition );
} }
delete dlg; delete dlg;
} }