From 97a1f41c4d79f471c36207ec4d86e1a346b8df83 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Tue, 14 Dec 2021 17:32:12 +0000 Subject: [PATCH] I hate `auto`. This creates a QStringRref, not a QString, then crashes. We can't pass a QStringRef to QUrl::fromLocalFile, this accepts a const QString& and then QStringRef will decay to a QString() but it's UB to hold a const ref to a temporary. --- src/project/project.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/project/project.cpp b/src/project/project.cpp index 42e00bc0c..47d11912c 100644 --- a/src/project/project.cpp +++ b/src/project/project.cpp @@ -205,7 +205,7 @@ QString Project::workingDir() const KTextEditor::Document* Project::createCodeDocument(const QString& filePath) { - auto path = d->m_workingDirectory.path() + QLatin1Char('/') + filePath + QStringLiteral(".js"); + const QString path = d->m_workingDirectory.path() + QLatin1Char('/') + filePath + QStringLiteral(".js"); auto doc = KTextEditor::Editor::instance()->createDocument(nullptr); if (!doc->saveAs(QUrl::fromLocalFile(path))) { -- GitLab