From b4cefff975138e621d9a9437891c9d1b09616b74 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 26 Feb 2019 07:21:36 -0500 Subject: [PATCH] [partition] Avoid heap-wrangling - The CreatePartitionDialog doesn't need to be on the heap, it's modal here. Avoid QPointer weirdness as well. --- src/modules/partition/gui/PartitionPage.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/modules/partition/gui/PartitionPage.cpp b/src/modules/partition/gui/PartitionPage.cpp index 4e1e093b1..5b8f17fd0 100644 --- a/src/modules/partition/gui/PartitionPage.cpp +++ b/src/modules/partition/gui/PartitionPage.cpp @@ -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