mirror of
https://github.com/parchlinux/calamares.git
synced 2025-02-24 10:55:46 -05:00
[partition] Don't hang on to pointer longer than needed
This commit is contained in:
parent
04b119b051
commit
2a1ec84c87
2 changed files with 15 additions and 7 deletions
|
@ -277,20 +277,20 @@ stringify( const QList< MessageAndPath >& news )
|
|||
|
||||
ClearMountsJob::ClearMountsJob( Device* device )
|
||||
: Calamares::Job()
|
||||
, m_device( device )
|
||||
, m_deviceNode( device->deviceNode() )
|
||||
{
|
||||
}
|
||||
|
||||
QString
|
||||
ClearMountsJob::prettyName() const
|
||||
{
|
||||
return tr( "Clear mounts for partitioning operations on %1" ).arg( m_device->deviceNode() );
|
||||
return tr( "Clear mounts for partitioning operations on %1" ).arg( m_deviceNode );
|
||||
}
|
||||
|
||||
QString
|
||||
ClearMountsJob::prettyStatusMessage() const
|
||||
{
|
||||
return tr( "Clearing mounts for partitioning operations on %1." ).arg( m_device->deviceNode() );
|
||||
return tr( "Clearing mounts for partitioning operations on %1." ).arg( m_deviceNode );
|
||||
}
|
||||
|
||||
Calamares::JobResult
|
||||
|
@ -298,13 +298,13 @@ ClearMountsJob::exec()
|
|||
{
|
||||
CalamaresUtils::Partition::Syncer s;
|
||||
|
||||
QString deviceName = m_device->deviceNode().split( '/' ).last();
|
||||
const QString deviceName = m_deviceNode.split( '/' ).last();
|
||||
|
||||
QList< MessageAndPath > goodNews;
|
||||
QProcess process;
|
||||
|
||||
const QStringList partitionsList = getPartitionsForDevice( deviceName );
|
||||
const QStringList swapPartitions = getSwapsForDevice( m_device->deviceNode() );
|
||||
const QStringList swapPartitions = getSwapsForDevice( m_deviceNode );
|
||||
|
||||
apply( getCryptoDevices(), tryCryptoClose, goodNews );
|
||||
|
||||
|
@ -377,7 +377,7 @@ ClearMountsJob::exec()
|
|||
apply( swapPartitions, tryClearSwap, goodNews );
|
||||
|
||||
Calamares::JobResult ok = Calamares::JobResult::ok();
|
||||
ok.setMessage( tr( "Cleared all mounts for %1" ).arg( m_device->deviceNode() ) );
|
||||
ok.setMessage( tr( "Cleared all mounts for %1" ).arg( m_deviceNode ) );
|
||||
ok.setDetails( stringify( goodNews ).join( "\n" ) );
|
||||
cDebug() << "ClearMountsJob finished. Here's what was done:" << Logger::DebugListT< MessageAndPath >( goodNews );
|
||||
|
||||
|
|
|
@ -22,13 +22,21 @@ class ClearMountsJob : public Calamares::Job
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
/** @brief Creates a job freeing mounts on @p device
|
||||
*
|
||||
* All /dev/mapper entries are closed, regardless of device.
|
||||
*
|
||||
* No ownership is transferred; the @p device is used only to access
|
||||
* the device node (name).
|
||||
*/
|
||||
explicit ClearMountsJob( Device* device );
|
||||
|
||||
QString prettyName() const override;
|
||||
QString prettyStatusMessage() const override;
|
||||
Calamares::JobResult exec() override;
|
||||
|
||||
private:
|
||||
Device* m_device;
|
||||
const QString m_deviceNode;
|
||||
};
|
||||
|
||||
#endif // CLEARMOUNTSJOB_H
|
||||
|
|
Loading…
Add table
Reference in a new issue