Commit d5c646f1 authored by Fushan Wen's avatar Fushan Wen
Browse files

kded: properly delete factory to fix file descriptor leak

Not unloading the plugin loader will cause file descriptor leaks in
kded, and when fd limit is reached, accent color can't be updated
anymore because updating accent color requires writing to kdeglobals.
This fixes the leak and also fixes the accent color bug.

BUG: 458430
BUG: 458817
CCBUG: 459870
FIXED-IN: 5.26

(cherry picked from commit 3c243781)
parent 1af9f3de
Pipeline #241636 passed with stage
in 39 seconds
......@@ -43,13 +43,13 @@ DummyDecorationBridge::DummyDecorationBridge(const QString &decorationTheme, QOb
m_decorationsConfigFileName = QStringLiteral("breezerc");
m_pluginPath = windowDecorationPluginPath(decorationTheme);
QVariantMap args({{QStringLiteral("bridge"), QVariant::fromValue(this)}});
m_factory = KPluginFactory::loadFactory(KPluginMetaData(m_pluginPath)).plugin;
const QString pluginPath = windowDecorationPluginPath(decorationTheme);
m_factory = qobject_cast<KPluginFactory *>(m_pluginLoader.instance());
if (m_factory) {
const QVariantMap args({{QStringLiteral("bridge"), QVariant::fromValue(this)}});
m_decoration = m_factory->create<KDecoration2::Decoration>(m_factory, QVariantList({args}));
......@@ -66,7 +66,7 @@ DummyDecorationBridge::DummyDecorationBridge(const QString &decorationTheme, QOb
std::unique_ptr<KDecoration2::DecorationSettingsPrivate> DummyDecorationBridge::settings(KDecoration2::DecorationSettings *parent)
......@@ -6,6 +6,7 @@
#pragma once
#include <QPluginLoader>
#include <QString>
#include <KDecoration2/Decoration>
......@@ -48,11 +49,11 @@ private:
QString m_decorationsConfigFileName;
double globalAnimationEntryValue;
QPluginLoader m_pluginLoader;
KPluginFactory *m_factory;
KDecoration2::Decoration *m_decoration;
KDecoration2::DecoratedClientPrivate *m_client;
KDecoration2::DummyDecorationSettings *m_settings;
QString m_pluginPath;
Supports Markdown
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