From 0497a6e917c9cf6c49d30658d11d4e624037610d Mon Sep 17 00:00:00 2001 From: Fabian Vogt Date: Fri, 14 Sep 2018 11:35:12 +0200 Subject: [PATCH] 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 --- src/sddmkcm.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) Index: sddm-kcm-5.13.90/src/sddmkcm.cpp =================================================================== --- sddm-kcm-5.13.90.orig/src/sddmkcm.cpp +++ sddm-kcm-5.13.90/src/sddmkcm.cpp @@ -62,10 +62,12 @@ SddmKcm::SddmKcm(QWidget *parent, const // This does not listen for new config files in the directory. QStringList configFiles = QDir(QString::fromLatin1(SDDM_CONFIG_DIR)).entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::LocaleAware), systemConfigFiles = QDir(QString::fromLatin1(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);