Paste P278

Masterwork From Distant Lands
ActivePublic

Authored by davidedmundson on Dec 6 2018, 2:22 AM.
commit 9f0bbd4537aa20afd65961a250e6d963ea777a15
Author: David Edmundson <kde@davidedmundson.co.uk>
Date: Thu Dec 6 02:22:33 2018 +0000
Fix deleting of this midway through Shadow::updateShadow
diff --git a/shadow.cpp b/shadow.cpp
index 8ba322dd6..2cbabb01b 100644
--- a/shadow.cpp
+++ b/shadow.cpp
@@ -331,15 +331,6 @@ void Shadow::buildQuads()
bool Shadow::updateShadow()
{
- auto clear = [topLevel = m_topLevel] {
- if (topLevel && topLevel->shadow()) {
- auto w = topLevel->effectWindow();
- // this also deletes the shadow
- w->sceneWindow()->updateShadow(nullptr);
- emit topLevel->shadowChanged();
- }
- };
-
if (!m_topLevel) {
return false;
}
@@ -348,12 +339,10 @@ bool Shadow::updateShadow()
if (AbstractClient *c = qobject_cast<AbstractClient*>(m_topLevel)) {
if (c->decoration()) {
if (init(c->decoration())) {
- emit m_topLevel->shadowChanged();
return true;
}
}
}
- clear();
return false;
}
@@ -361,7 +350,6 @@ bool Shadow::updateShadow()
if (m_topLevel && m_topLevel->surface()) {
if (const auto &s = m_topLevel->surface()->shadow()) {
if (init(s)) {
- emit m_topLevel->shadowChanged();
return true;
}
}
@@ -370,12 +358,10 @@ bool Shadow::updateShadow()
auto data = Shadow::readX11ShadowProperty(m_topLevel->window());
if (data.isEmpty()) {
- clear();
return false;
}
init(data);
- emit m_topLevel->shadowChanged();
return true;
}
diff --git a/toplevel.cpp b/toplevel.cpp
index bff868f6f..0b83e621f 100644
--- a/toplevel.cpp
+++ b/toplevel.cpp
@@ -336,7 +336,10 @@ void Toplevel::getShadow()
const QRect oldVisibleRect = visibleRect();
if (hasShadow()) {
dirtyRect = shadow()->shadowRegion().boundingRect();
- effectWindow()->sceneWindow()->shadow()->updateShadow();
+ if (!effectWindow()->sceneWindow()->shadow()->updateShadow()) {
+ effectWindow()->sceneWindow()->updateShadow(nullptr);
+ }
+ emit shadowChanged();
} else {
Shadow::createShadow(this);
}
davidedmundson edited the content of this paste. (Show Details)Dec 6 2018, 2:22 AM
davidedmundson changed the title of this paste from untitled to Masterwork From Distant Lands.