[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.
This commit is contained in:
Martin Gräßlin 2016-05-23 09:28:27 +02:00
parent 1d9653953b
commit 00fe5ec401
2 changed files with 8 additions and 1 deletions

View file

@ -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());

View file

@ -99,6 +99,7 @@ private:
void createRenderer();
AbstractClient *m_client;
Renderer *m_renderer;
QMetaObject::Connection m_compositorToggledConnection;
};
}