Commit 1a13015d authored by David Edmundson's avatar David Edmundson

Possible fix for KDecoration crash in systemsettings

Summary:
I could never reproduce the crash, but we know from gdb that it's from
the decorationSettings object

We are setting the same QObject instance as a context property in
multiple contexts at once. This is already slightly odd especially from the POV of
Qt's internal property cache.

Given we want one object to be exposed to all contexts, we can expose it
to the parent context only once and achieve the same result in a simpler
way.

BUG: 411166

Test Plan:
Verified opening and closing system settings still worked for me.
I could never reproduce the original crash.

Reviewers: #kwin, ngraham

Reviewed By: ngraham

Subscribers: ngraham, apol, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D25913
parent cab72500
......@@ -262,6 +262,7 @@ Decoration::Decoration(QObject *parent, const QVariantList &args)
{
m_themeName = findTheme(args);
Helper::instance().ref();
Helper::instance().rootContext()->setContextProperty(QStringLiteral("decorationSettings"), settings().data());
}
Decoration::~Decoration()
......@@ -289,7 +290,6 @@ void Decoration::init()
m_qmlContext = new QQmlContext(Helper::instance().rootContext(), this);
m_qmlContext->setContextProperty(QStringLiteral("decoration"), this);
m_qmlContext->setContextProperty(QStringLiteral("decorationSettings"), s.data());
auto component = Helper::instance().component(m_themeName);
if (!component) {
return;
......
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