diff --git a/composite.cpp b/composite.cpp index 44a3865be4..3cb8bc8ae7 100644 --- a/composite.cpp +++ b/composite.cpp @@ -690,10 +690,6 @@ void Toplevel::finishCompositing() damage_region = QRegion(); repaints_region = QRegion(); effect_window = NULL; - if (hasShadow()) { - delete m_shadow; - m_shadow = NULL; - } #endif } diff --git a/shadow.cpp b/shadow.cpp index 0dba4e8650..422313e1e6 100644 --- a/shadow.cpp +++ b/shadow.cpp @@ -171,4 +171,10 @@ bool Shadow::updateShadow() return true; } +void Shadow::setToplevel(Toplevel *topLevel) +{ + m_topLevel = topLevel; + setParent(topLevel); +} + } // namespace diff --git a/shadow.h b/shadow.h index 2a5aeda4e9..6b4719ed57 100644 --- a/shadow.h +++ b/shadow.h @@ -85,6 +85,13 @@ public: **/ static Shadow *createShadow(Toplevel *toplevel); + /** + * Reparents the shadow to @p toplevel. + * Used when a window is deleted. + * @param toplevel The new parent + **/ + void setToplevel(Toplevel *toplevel); + protected: Shadow(Toplevel *toplevel); enum ShadowElements { diff --git a/toplevel.cpp b/toplevel.cpp index 68a4350491..99a5f42237 100644 --- a/toplevel.cpp +++ b/toplevel.cpp @@ -135,8 +135,7 @@ void Toplevel::copyToDeleted(Toplevel* c) c->window_pix = None; if (c->hasShadow()) { m_shadow = c->m_shadow; - c->m_shadow->setParent(this); - c->m_shadow = NULL; + m_shadow->setToplevel(this); } } @@ -145,6 +144,7 @@ void Toplevel::copyToDeleted(Toplevel* c) void Toplevel::disownDataPassedToDeleted() { info = NULL; + m_shadow = NULL; } QRect Toplevel::visibleRect() const diff --git a/unmanaged.cpp b/unmanaged.cpp index e717bf89f9..6fcd47398d 100644 --- a/unmanaged.cpp +++ b/unmanaged.cpp @@ -92,7 +92,7 @@ void Unmanaged::release() XShapeSelectInput(display(), window(), NoEventMask); XSelectInput(display(), window(), NoEventMask); } - addWorkspaceRepaint(geometry()); + addWorkspaceRepaint(visibleRect()); disownDataPassedToDeleted(); del->unrefWindow(); deleteUnmanaged(this, Allowed);