Prevent crash when going back from EraseDiskPage and then next.
This was caused by an invalid reference to a device model in the partitioning preview widget after a PCM revert.
This commit is contained in:
parent
9fcd8113e5
commit
4468e30317
@ -1,6 +1,6 @@
|
|||||||
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
||||||
*
|
*
|
||||||
* Copyright 2014, Teo Mrnjavac <teo@kde.org>
|
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
|
||||||
*
|
*
|
||||||
* Calamares is free software: you can redistribute it and/or modify
|
* Calamares is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -38,6 +38,7 @@
|
|||||||
#include <QFormLayout>
|
#include <QFormLayout>
|
||||||
#include <QListView>
|
#include <QListView>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
#include <QMutexLocker>
|
||||||
|
|
||||||
EraseDiskPage::EraseDiskPage( QWidget* parent )
|
EraseDiskPage::EraseDiskPage( QWidget* parent )
|
||||||
: QWidget( parent )
|
: QWidget( parent )
|
||||||
@ -103,6 +104,9 @@ EraseDiskPage::init( PartitionCoreModule* core )
|
|||||||
if ( dev )
|
if ( dev )
|
||||||
doAutopartition( dev );
|
doAutopartition( dev );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
connect( m_core, &PartitionCoreModule::isDirtyChanged,
|
||||||
|
this, &EraseDiskPage::updatePreviews );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -187,11 +191,27 @@ EraseDiskPage::doAutopartition( Device* dev )
|
|||||||
PartitionInfo::setFormat( rootPartition, true );
|
PartitionInfo::setFormat( rootPartition, true );
|
||||||
m_core->createPartition( dev, rootPartition );
|
m_core->createPartition( dev, rootPartition );
|
||||||
|
|
||||||
|
updatePreviews();
|
||||||
|
|
||||||
{
|
m_core->dumpQueue();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
EraseDiskPage::updatePreviews()
|
||||||
|
{
|
||||||
|
QMutexLocker( &EraseDiskPage::m_previewsMutex );
|
||||||
|
|
||||||
|
cDebug() << "Updating partitioning preview widgets.";
|
||||||
qDeleteAll( m_previewFrame->children() );
|
qDeleteAll( m_previewFrame->children() );
|
||||||
m_previewFrame->layout()->deleteLater();
|
m_previewFrame->layout()->deleteLater();
|
||||||
|
|
||||||
|
if ( m_drivesView->selectionModel()->currentIndex() == QModelIndex() )
|
||||||
|
{
|
||||||
|
cDebug() << "No disk selected, bailing out.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QFormLayout* layout = new QFormLayout;
|
QFormLayout* layout = new QFormLayout;
|
||||||
m_previewFrame->setLayout( layout );
|
m_previewFrame->setLayout( layout );
|
||||||
layout->setMargin( 0 );
|
layout->setMargin( 0 );
|
||||||
@ -213,6 +233,4 @@ EraseDiskPage::doAutopartition( Device* dev )
|
|||||||
info.partitionModelAfter->setParent( m_previewFrame );
|
info.partitionModelAfter->setParent( m_previewFrame );
|
||||||
layout->addRow( tr( "After:" ), preview );
|
layout->addRow( tr( "After:" ), preview );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
m_core->dumpQueue();
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
||||||
*
|
*
|
||||||
* Copyright 2014, Teo Mrnjavac <teo@kde.org>
|
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
|
||||||
*
|
*
|
||||||
* Calamares is free software: you can redistribute it and/or modify
|
* Calamares is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -19,6 +19,7 @@
|
|||||||
#ifndef ERASEDISKPAGE_H
|
#ifndef ERASEDISKPAGE_H
|
||||||
#define ERASEDISKPAGE_H
|
#define ERASEDISKPAGE_H
|
||||||
|
|
||||||
|
#include <QMutex>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
class PartitionCoreModule;
|
class PartitionCoreModule;
|
||||||
@ -41,11 +42,14 @@ signals:
|
|||||||
private:
|
private:
|
||||||
void setNextEnabled( bool enabled );
|
void setNextEnabled( bool enabled );
|
||||||
void doAutopartition( Device* dev );
|
void doAutopartition( Device* dev );
|
||||||
|
void updatePreviews();
|
||||||
|
|
||||||
QListView* m_drivesView;
|
QListView* m_drivesView;
|
||||||
PartitionCoreModule* m_core;
|
PartitionCoreModule* m_core;
|
||||||
QWidget* m_previewFrame;
|
QWidget* m_previewFrame;
|
||||||
|
|
||||||
|
QMutex m_previewsMutex;
|
||||||
|
|
||||||
bool m_nextEnabled;
|
bool m_nextEnabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user