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;