From 590b531863bc0267b5ab3d5ef21a28fb716ee5ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= Date: Mon, 25 Dec 2017 00:11:13 +0000 Subject: [PATCH] Commit partition table when closing Sfdisk backend device. --- src/plugins/sfdisk/sfdiskdevice.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/plugins/sfdisk/sfdiskdevice.cpp b/src/plugins/sfdisk/sfdiskdevice.cpp index f373df7..2869a79 100644 --- a/src/plugins/sfdisk/sfdiskdevice.cpp +++ b/src/plugins/sfdisk/sfdiskdevice.cpp @@ -31,6 +31,7 @@ SfdiskDevice::SfdiskDevice(const Device& d) : SfdiskDevice::~SfdiskDevice() { + close(); } bool SfdiskDevice::open() @@ -50,19 +51,16 @@ bool SfdiskDevice::close() if (isExclusive()) setExclusive(false); + CoreBackendPartitionTable* ptable = new SfdiskPartitionTable(m_device); + ptable->commit(); + delete ptable; + return true; } CoreBackendPartitionTable* SfdiskDevice::openPartitionTable() { - CoreBackendPartitionTable* ptable = new SfdiskPartitionTable(m_device); - - if (ptable == nullptr || !ptable->open()) { - delete ptable; - ptable = nullptr; - } - - return ptable; + return new SfdiskPartitionTable(m_device); } bool SfdiskDevice::createPartitionTable(Report& report, const PartitionTable& ptable)