Commit 0497a6e9 authored by Fabian Vogt's avatar Fabian Vogt
Browse files

Workaround QTBUG-47066 to fix crash on startup

The lambda returns a QStringBuilder which contains dangling references.
Work around that by converting to QString inside the lambda's context.

Test Plan: Does not crash anymore.

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision:
parent 994fd06c
......@@ -63,10 +63,12 @@ SddmKcm::SddmKcm(QWidget *parent, const QVariantList &args) :
// This does not listen for new config files in the directory.
QStringList configFiles = QDir(SDDM_CONFIG_DIR).entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::LocaleAware),
systemConfigFiles = QDir(SDDM_SYSTEM_CONFIG_DIR).entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::LocaleAware);
// QStringBuilder keeps dangling references, so force return of QString (QTBUG-47066)
std::transform(systemConfigFiles.begin(), systemConfigFiles.end(), systemConfigFiles.begin(),
[](const QString &filename) { return QStringLiteral(SDDM_SYSTEM_CONFIG_DIR "/") + filename; });
[](const QString &filename) -> QString { return QStringLiteral(SDDM_SYSTEM_CONFIG_DIR "/") + filename; });
std::transform(configFiles.begin(), configFiles.end(), configFiles.begin(),
[](const QString &filename) { return QStringLiteral(SDDM_CONFIG_DIR "/") + filename; });
[](const QString &filename) -> QString { return QStringLiteral(SDDM_CONFIG_DIR "/") + filename; });
mSddmConfig->addConfigSources(systemConfigFiles + configFiles);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment