diff --git a/scene.h b/scene.h --- a/scene.h +++ b/scene.h @@ -538,12 +538,6 @@ } inline -void Scene::Window::updateShadow(Shadow* shadow) -{ - m_shadow = shadow; -} - -inline const Shadow* Scene::Window::shadow() const { return m_shadow; diff --git a/scene.cpp b/scene.cpp --- a/scene.cpp +++ b/scene.cpp @@ -928,6 +928,15 @@ return ret; } +void Scene::Window::updateShadow(Shadow* shadow) +{ + if (m_shadow == shadow) { + return; + } + delete m_shadow; + m_shadow = shadow; +} + //**************************************** // WindowPixmap //**************************************** diff --git a/shadow.cpp b/shadow.cpp --- a/shadow.cpp +++ b/shadow.cpp @@ -337,10 +337,11 @@ auto clear = [this]() { if (m_topLevel && m_topLevel->effectWindow() && m_topLevel->effectWindow()->sceneWindow() && m_topLevel->effectWindow()->sceneWindow()->shadow()) { - m_topLevel->effectWindow()->sceneWindow()->updateShadow(0); - m_topLevel->effectWindow()->buildQuads(true); + auto w = m_topLevel->effectWindow(); + // this also deletes the shadow + w->sceneWindow()->updateShadow(nullptr); + w->buildQuads(true); } - deleteLater(); }; if (m_decorationShadow) { if (AbstractClient *c = qobject_cast(m_topLevel)) {