From c8c0bace31907391e9393370f2f74a059d6cb9af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Fri, 25 Jul 2014 07:14:21 +0200 Subject: [PATCH] Destroy DecorationRenderer in setup/finish compositing So far the DecorationRenderer got destroyed and recreated after the signal compositing toggled was emitted. But that's too late for e.g. the OpenGL Textures to be destroyed. So lets trigger the destroy directly in setup/finish compositing. The new renderer will still be created after the compositing toggled is emitted - we don't want to have it recreated for the still active compositer type. --- composite.cpp | 8 +++++++- decorations/decoratedclient.cpp | 6 ++++++ decorations/decoratedclient.h | 1 + 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/composite.cpp b/composite.cpp index 5408077f44..5c5c64783a 100644 --- a/composite.cpp +++ b/composite.cpp @@ -39,6 +39,7 @@ along with this program. If not, see . #if HAVE_WAYLAND #include "wayland_backend.h" #endif +#include "decorations/decoratedclient.h" #include @@ -1105,6 +1106,9 @@ bool Client::setupCompositing() if (!Toplevel::setupCompositing()){ return false; } + if (decoratedClient()) { + decoratedClient()->destroyRenderer(); + } updateVisibility(); // for internalKeep() return true; } @@ -1114,7 +1118,9 @@ void Client::finishCompositing(ReleaseReason releaseReason) Toplevel::finishCompositing(releaseReason); updateVisibility(); if (!deleting) { - triggerDecorationRepaint(); + if (decoratedClient()) { + decoratedClient()->destroyRenderer(); + } } // for safety in case KWin is just resizing the window s_haveResizeEffect = false; diff --git a/decorations/decoratedclient.cpp b/decorations/decoratedclient.cpp index d69177c113..14ae4f91a7 100644 --- a/decorations/decoratedclient.cpp +++ b/decorations/decoratedclient.cpp @@ -197,5 +197,11 @@ void DecoratedClientImpl::createRenderer() } } +void DecoratedClientImpl::destroyRenderer() +{ + delete m_renderer; + m_renderer = nullptr; +} + } } diff --git a/decorations/decoratedclient.h b/decorations/decoratedclient.h index 482853c914..100b9c3290 100644 --- a/decorations/decoratedclient.h +++ b/decorations/decoratedclient.h @@ -81,6 +81,7 @@ public: Renderer *renderer() { return m_renderer; } + void destroyRenderer(); KDecoration2::DecoratedClient *decoratedClient() { return KDecoration2::DecoratedClientPrivate::client(); }