Commit 83289058 authored by Alois Wohlschlager's avatar Alois Wohlschlager 🌾 Committed by Nate Graham
Browse files

Use unique temporary directory for CSD assets, and clean it up

The configurator used a fixed temporary directory for the CSD button
files, and never deleted it. This is not feasible on multi-user systems.
Change it to use a random path which is cleaned up afterwards.

BUG: 433608
FIXED-IN: 5.21.2


(cherry picked from commit 605d912d)
parent cbfb855a
......@@ -25,7 +25,8 @@
ConfigValueProvider::ConfigValueProvider() :
kdeglobalsConfig(KSharedConfig::openConfig()),
inputConfig(KSharedConfig::openConfig(QStringLiteral("kcminputrc"))),
kwinConfig(KSharedConfig::openConfig(QStringLiteral("kwinrc")))
kwinConfig(KSharedConfig::openConfig(QStringLiteral("kwinrc"))),
generatedCSDTempPath(QDir::tempPath() + QStringLiteral("/plasma-csd-generator"))
{
}
......@@ -197,9 +198,7 @@ QStringList ConfigValueProvider::windowDecorationsButtonsImages() const
for (const auto &buttonState : buttonStates) {
QSvgGenerator svgGenerator {};
const QString fileDirPath = QDir::tempPath() + QStringLiteral("/plasma-csd-generator");
QDir(fileDirPath).mkpath(QStringLiteral("."));
QString filePath = QStringLiteral("%1/%2-%3.svg").arg(fileDirPath, buttonType, buttonState);
QString filePath = generatedCSDTempPath.filePath(QStringLiteral("%1-%2.svg").arg(buttonType, buttonState));
svgGenerator.setFileName(filePath);
svgGenerator.setViewBox(DecorationPainter::ButtonGeometry);
......
......@@ -6,6 +6,8 @@
#pragma once
#include <QTemporaryDir>
#include <KSharedConfig>
class QString;
......@@ -38,4 +40,6 @@ private:
KSharedConfigPtr kdeglobalsConfig;
KSharedConfigPtr inputConfig;
KSharedConfigPtr kwinConfig;
QTemporaryDir generatedCSDTempPath;
};
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