[partition] Avoid heap-wrangling

- The CreatePartitionDialog doesn't need to be on the heap, it's
   modal here. Avoid QPointer weirdness as well.
This commit is contained in:
Adriaan de Groot 2019-02-26 07:21:36 -05:00
parent 943f3fb1f9
commit b4cefff975

View File

@ -362,18 +362,18 @@ PartitionPage::onCreateClicked()
if ( !checkCanCreate( model->device() ) )
return;
QPointer< CreatePartitionDialog > dlg = new CreatePartitionDialog( model->device(),
partition->parent(),
nullptr,
getCurrentUsedMountpoints(),
this );
dlg->initFromFreeSpace( partition );
if ( dlg->exec() == QDialog::Accepted )
CreatePartitionDialog dlg(
model->device(),
partition->parent(),
nullptr,
getCurrentUsedMountpoints(),
this );
dlg.initFromFreeSpace( partition );
if ( dlg.exec() == QDialog::Accepted )
{
Partition* newPart = dlg->createPartition();
m_core->createPartition( model->device(), newPart, dlg->newFlags() );
Partition* newPart = dlg.createPartition();
m_core->createPartition( model->device(), newPart, dlg.newFlags() );
}
delete dlg;
}
void