Move EffectWindow and SceneWindow to Deleted

It simplifies finishCompositing() function.
This commit is contained in:
Vlad Zahorodnii 2022-04-27 18:31:28 +03:00
parent b522bbc8fc
commit d24f908720
2 changed files with 7 additions and 13 deletions

View file

@ -539,7 +539,7 @@ void EffectsHandlerImpl::slotWindowClosed(KWin::Window *c, KWin::Deleted *d)
{ {
c->disconnect(this); c->disconnect(this);
if (d) { if (d) {
Q_EMIT windowClosed(c->effectWindow()); Q_EMIT windowClosed(d->effectWindow());
} }
} }

View file

@ -181,15 +181,15 @@ void Window::copyToDeleted(Window *c)
m_client.reset(c->m_client, false); m_client.reset(c->m_client, false);
ready_for_painting = c->ready_for_painting; ready_for_painting = c->ready_for_painting;
is_shape = c->is_shape; is_shape = c->is_shape;
m_effectWindow = c->m_effectWindow; m_effectWindow = std::exchange(c->m_effectWindow, nullptr);
if (m_effectWindow != nullptr) { if (m_effectWindow != nullptr) {
m_effectWindow->setWindow(this); m_effectWindow->setWindow(this);
} }
m_sceneWindow = c->m_sceneWindow; m_sceneWindow = std::exchange(c->m_sceneWindow, nullptr);
if (m_sceneWindow != nullptr) { if (m_sceneWindow != nullptr) {
m_sceneWindow->setToplevel(this); m_sceneWindow->setToplevel(this);
} }
m_shadow = c->m_shadow; m_shadow = std::exchange(c->m_shadow, nullptr);
if (m_shadow) { if (m_shadow) {
m_shadow->setToplevel(this); m_shadow->setToplevel(this);
} }
@ -366,15 +366,9 @@ void Window::finishCompositing(ReleaseReason releaseReason)
item->destroyDamage(); item->destroyDamage();
} }
} }
if (m_shadow && m_shadow->toplevel() == this) { // otherwise it's already passed to Deleted, don't free data deleteShadow();
deleteShadow(); deleteEffectWindow();
} deleteSceneWindow();
if (m_effectWindow && m_effectWindow->window() == this) { // otherwise it's already passed to Deleted, don't free data
deleteEffectWindow();
}
if (m_sceneWindow && m_sceneWindow->window() == this) { // otherwise it's already passed to Deleted, don't free data
deleteSceneWindow();
}
} }
void Window::addRepaint(const QRect &rect) void Window::addRepaint(const QRect &rect)