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

Workaround QTBUG-47066 to fix crash on startup

Summary:
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: https://phabricator.kde.org/D15498
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);
......
Markdown is supported
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