[partition] Don't hang on to pointer longer than needed
This commit is contained in:
parent
04b119b051
commit
2a1ec84c87
@ -277,20 +277,20 @@ stringify( const QList< MessageAndPath >& news )
|
|||||||
|
|
||||||
ClearMountsJob::ClearMountsJob( Device* device )
|
ClearMountsJob::ClearMountsJob( Device* device )
|
||||||
: Calamares::Job()
|
: Calamares::Job()
|
||||||
, m_device( device )
|
, m_deviceNode( device->deviceNode() )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QString
|
QString
|
||||||
ClearMountsJob::prettyName() const
|
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
|
QString
|
||||||
ClearMountsJob::prettyStatusMessage() const
|
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
|
Calamares::JobResult
|
||||||
@ -298,13 +298,13 @@ ClearMountsJob::exec()
|
|||||||
{
|
{
|
||||||
CalamaresUtils::Partition::Syncer s;
|
CalamaresUtils::Partition::Syncer s;
|
||||||
|
|
||||||
QString deviceName = m_device->deviceNode().split( '/' ).last();
|
const QString deviceName = m_deviceNode.split( '/' ).last();
|
||||||
|
|
||||||
QList< MessageAndPath > goodNews;
|
QList< MessageAndPath > goodNews;
|
||||||
QProcess process;
|
QProcess process;
|
||||||
|
|
||||||
const QStringList partitionsList = getPartitionsForDevice( deviceName );
|
const QStringList partitionsList = getPartitionsForDevice( deviceName );
|
||||||
const QStringList swapPartitions = getSwapsForDevice( m_device->deviceNode() );
|
const QStringList swapPartitions = getSwapsForDevice( m_deviceNode );
|
||||||
|
|
||||||
apply( getCryptoDevices(), tryCryptoClose, goodNews );
|
apply( getCryptoDevices(), tryCryptoClose, goodNews );
|
||||||
|
|
||||||
@ -377,7 +377,7 @@ ClearMountsJob::exec()
|
|||||||
apply( swapPartitions, tryClearSwap, goodNews );
|
apply( swapPartitions, tryClearSwap, goodNews );
|
||||||
|
|
||||||
Calamares::JobResult ok = Calamares::JobResult::ok();
|
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" ) );
|
ok.setDetails( stringify( goodNews ).join( "\n" ) );
|
||||||
cDebug() << "ClearMountsJob finished. Here's what was done:" << Logger::DebugListT< MessageAndPath >( goodNews );
|
cDebug() << "ClearMountsJob finished. Here's what was done:" << Logger::DebugListT< MessageAndPath >( goodNews );
|
||||||
|
|
||||||
|
@ -22,13 +22,21 @@ class ClearMountsJob : public Calamares::Job
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
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 );
|
explicit ClearMountsJob( Device* device );
|
||||||
|
|
||||||
QString prettyName() const override;
|
QString prettyName() const override;
|
||||||
QString prettyStatusMessage() const override;
|
QString prettyStatusMessage() const override;
|
||||||
Calamares::JobResult exec() override;
|
Calamares::JobResult exec() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Device* m_device;
|
const QString m_deviceNode;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CLEARMOUNTSJOB_H
|
#endif // CLEARMOUNTSJOB_H
|
||||||
|
Loading…
Reference in New Issue
Block a user