From f78ff8eaa5cc723e1a4d46fc6242e110ad599d96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Wed, 3 Dec 2014 13:10:35 +0100 Subject: [PATCH] Do not emit DecorationSettings::alphaChannelSupportedChanged on tear down The Compositor is destroyed before the Client and Decorations are destroyed on shutdown. This meant the Decorations reacted needlessly on the alpha channel supported. E.g. Aurorae recreated the Decoration and most likely crashed in Qt. With this change the signal gets disconnected and the Decorations just don't do anything. --- composite.cpp | 1 + composite.h | 1 + decorations/settings.cpp | 8 +++++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/composite.cpp b/composite.cpp index 9983ed3a84..43e5ead886 100644 --- a/composite.cpp +++ b/composite.cpp @@ -133,6 +133,7 @@ Compositor::Compositor(QObject* workspace) Compositor::~Compositor() { + emit aboutToDestroy(); finish(); deleteUnusedSupportProperties(); delete cm_selection; diff --git a/composite.h b/composite.h index 571eaba783..3a2a2a21ac 100644 --- a/composite.h +++ b/composite.h @@ -185,6 +185,7 @@ public Q_SLOTS: Q_SIGNALS: void compositingToggled(bool active); + void aboutToDestroy(); protected: void timerEvent(QTimerEvent *te); diff --git a/decorations/settings.cpp b/decorations/settings.cpp index 2e08dcd366..d8bd039a98 100644 --- a/decorations/settings.cpp +++ b/decorations/settings.cpp @@ -39,7 +39,7 @@ SettingsImpl::SettingsImpl(KDecoration2::DecorationSettings *parent) { readSettings(); - connect(Compositor::self(), &Compositor::compositingToggled, + auto c = connect(Compositor::self(), &Compositor::compositingToggled, parent, &KDecoration2::DecorationSettings::alphaChannelSupportedChanged); connect(VirtualDesktopManager::self(), &VirtualDesktopManager::countChanged, this, [parent](uint previous, uint current) { @@ -49,6 +49,12 @@ SettingsImpl::SettingsImpl(KDecoration2::DecorationSettings *parent) emit parent->onAllDesktopsAvailableChanged(current > 1); } ); + // prevent changes in Decoration due to Compositor being destroyed + connect(Compositor::self(), &Compositor::aboutToDestroy, this, + [this, c] { + disconnect(c); + } + ); } SettingsImpl::~SettingsImpl() = default;