From e482481262a4991b4e0631a3c8116255882580d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20G=C3=A2teau?= Date: Mon, 4 Aug 2014 19:23:39 +0200 Subject: [PATCH] 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() --- src/modules/partition/PartitionPage.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/modules/partition/PartitionPage.cpp b/src/modules/partition/PartitionPage.cpp index 88eb247b0..85955a366 100644 --- a/src/modules/partition/PartitionPage.cpp +++ b/src/modules/partition/PartitionPage.cpp @@ -216,8 +216,9 @@ PartitionPage::updatePartitionToCreate( Device* device, Partition* partition ) dlg->initFromPartitionToCreate( partition ); if ( dlg->exec() == QDialog::Accepted ) { + Partition* newPartition = dlg->createPartition(); m_core->deletePartition( device, partition ); - m_core->createPartition( device, dlg->createPartition() ); + m_core->createPartition( device, newPartition ); } delete dlg; }