diff --git a/src/modules/netinstall/Config.cpp b/src/modules/netinstall/Config.cpp index 491443654..5f703f8d4 100644 --- a/src/modules/netinstall/Config.cpp +++ b/src/modules/netinstall/Config.cpp @@ -93,6 +93,17 @@ Config::loadGroupList( const QVariantList& groupData ) emit statusReady(); } +void +Config::loadingDone() +{ + if ( m_queue ) + { + m_queue->deleteLater(); + m_queue = nullptr; + } +} + + void Config::setConfigurationMap( const QVariantMap& configurationMap ) { @@ -133,11 +144,8 @@ Config::setConfigurationMap( const QVariantMap& configurationMap ) } if ( m_queue ) { - connect( m_queue, &LoaderQueue::done, [this]() { - m_queue->deleteLater(); - m_queue = nullptr; - } ); - m_queue->fetchNext(); + connect( m_queue, &LoaderQueue::done, this, &Config::loadingDone ); + QMetaObject::invokeMethod( m_queue, "fetchNext", Qt::QueuedConnection ); } } diff --git a/src/modules/netinstall/Config.h b/src/modules/netinstall/Config.h index b8e258eff..d4c3c6f19 100644 --- a/src/modules/netinstall/Config.h +++ b/src/modules/netinstall/Config.h @@ -83,12 +83,13 @@ Q_SIGNALS: private Q_SLOTS: void retranslate(); + void loadingDone(); private: CalamaresUtils::Locale::TranslatedString* m_sidebarLabel = nullptr; // As it appears in the sidebar CalamaresUtils::Locale::TranslatedString* m_titleLabel = nullptr; PackageModel* m_model = nullptr; - LoaderQueue* m_queue; + LoaderQueue* m_queue = nullptr; Status m_status = Status::Ok; bool m_required = false; }; diff --git a/src/modules/netinstall/LoaderQueue.cpp b/src/modules/netinstall/LoaderQueue.cpp index 7236b4096..98245dead 100644 --- a/src/modules/netinstall/LoaderQueue.cpp +++ b/src/modules/netinstall/LoaderQueue.cpp @@ -95,6 +95,12 @@ LoaderQueue::fetch( const QUrl& url ) } } +/** @brief Call fetchNext() on the queue if it can + * + * On destruction, a new call to fetchNext() is queued, so that + * the queue continues loading. Calling release() before the + * destructor skips the fetchNext(), ending the queue-loading. + */ class FetchNextUnless { public: