diff --git a/decorations/decoratedclient.cpp b/decorations/decoratedclient.cpp index ae8353a1b5..f8c2426604 100644 --- a/decorations/decoratedclient.cpp +++ b/decorations/decoratedclient.cpp @@ -75,7 +75,7 @@ DecoratedClientImpl::DecoratedClientImpl(AbstractClient *client, KDecoration2::D &Decoration::DecoratedClientImpl::signalShadeChange); connect(client, &AbstractClient::keepAboveChanged, decoratedClient, &KDecoration2::DecoratedClient::keepAboveChanged); connect(client, &AbstractClient::keepBelowChanged, decoratedClient, &KDecoration2::DecoratedClient::keepBelowChanged); - connect(Compositor::self(), &Compositor::compositingToggled, this, + m_compositorToggledConnection = connect(Compositor::self(), &Compositor::compositingToggled, this, [this, decoration]() { delete m_renderer; m_renderer = nullptr; @@ -83,6 +83,12 @@ DecoratedClientImpl::DecoratedClientImpl(AbstractClient *client, KDecoration2::D decoration->update(); } ); + connect(Compositor::self(), &Compositor::aboutToDestroy, this, + [this] { + disconnect(m_compositorToggledConnection); + m_compositorToggledConnection = QMetaObject::Connection(); + } + ); connect(client, &AbstractClient::quickTileModeChanged, decoratedClient, [this, decoratedClient]() { emit decoratedClient->adjacentScreenEdgesChanged(adjacentScreenEdges()); diff --git a/decorations/decoratedclient.h b/decorations/decoratedclient.h index 2247076375..c51a27fff7 100644 --- a/decorations/decoratedclient.h +++ b/decorations/decoratedclient.h @@ -99,6 +99,7 @@ private: void createRenderer(); AbstractClient *m_client; Renderer *m_renderer; + QMetaObject::Connection m_compositorToggledConnection; }; }