From 4566e53d016f50b6bad9ec6fe2ef3fb79f02072c Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sat, 2 Dec 2017 12:11:56 -0500 Subject: [PATCH] [partition] Delay requirements checking until pmcore is initialized --- src/modules/partition/gui/PartitionViewStep.cpp | 16 ++++++++++------ src/modules/partition/gui/PartitionViewStep.h | 3 +++ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/modules/partition/gui/PartitionViewStep.cpp b/src/modules/partition/gui/PartitionViewStep.cpp index 264ec98f6..84d3ecc2c 100644 --- a/src/modules/partition/gui/PartitionViewStep.cpp +++ b/src/modules/partition/gui/PartitionViewStep.cpp @@ -539,17 +539,18 @@ PartitionViewStep::setConfigurationMap( const QVariantMap& configurationMap ) // Now that we have the config, we load the PartitionCoreModule in the background // because it could take a while. Then when it's done, we can set up the widgets // and remove the spinner. - QFutureWatcher< void >* watcher = new QFutureWatcher< void >(); - connect( watcher, &QFutureWatcher< void >::finished, - this, [ this, watcher ] + m_future = new QFutureWatcher< void >(); + connect( m_future, &QFutureWatcher< void >::finished, + this, [ this ] { continueLoading(); - watcher->deleteLater(); + this->m_future->deleteLater(); + this->m_future = nullptr; } ); QFuture< void > future = QtConcurrent::run( this, &PartitionViewStep::initPartitionCoreModule ); - watcher->setFuture( future ); + m_future->setFuture( future ); } @@ -561,13 +562,16 @@ PartitionViewStep::jobs() const Calamares::RequirementsList PartitionViewStep::checkRequirements() { + if (m_future) + m_future->waitForFinished(); + Calamares::RequirementsList l; l.append( { QLatin1Literal( "partitions" ), []{ return QString(); }, [this]{ return tr( "There are no partitons to install on." ); }, - false, // satisfied + m_core->deviceModel()->rowCount() > 0, // satisfied true // required } ); diff --git a/src/modules/partition/gui/PartitionViewStep.h b/src/modules/partition/gui/PartitionViewStep.h index 5a57d5074..c2b903d04 100644 --- a/src/modules/partition/gui/PartitionViewStep.h +++ b/src/modules/partition/gui/PartitionViewStep.h @@ -33,6 +33,8 @@ class PartitionPage; class PartitionCoreModule; class QStackedWidget; +template class QFutureWatcher; + /** * The starting point of the module. Instantiates PartitionCoreModule, * ChoicePage and PartitionPage, then connects them. @@ -78,6 +80,7 @@ private: PartitionPage* m_manualPartitionPage; QWidget* m_waitingWidget; + QFutureWatcher* m_future; }; CALAMARES_PLUGIN_FACTORY_DECLARATION( PartitionViewStepFactory )