summaryrefslogtreecommitdiffstats
path: root/patches/source/rocs/patch/rocs/97a1f41c4d79f471c36207ec4d86e1a346b8df83.patch
blob: 630acd127bcc8dc25d664edfe95c9d916bb0575b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
From 97a1f41c4d79f471c36207ec4d86e1a346b8df83 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <tcanabrava@kde.org>
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