From 00fe5ec40167b260e1efede7b0d441ff8024edec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Mon, 23 May 2016 09:28:27 +0200 Subject: [PATCH] [decorations] Don't recreate Renderer once the Compositor is destroyed If we get a compositingToggled because the Compositor is going down we don't need to recreate the Renderer as KWin as a whole is going down. Thus we disconnect the compositingToggled connection when the Compositor is about to be destroyed. --- decorations/decoratedclient.cpp | 8 +++++++- decorations/decoratedclient.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) 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; }; }