From 396f8f558c07e4c8b0d3090ebe5f65fab1d98f5a Mon Sep 17 00:00:00 2001 From: Vlad Zagorodniy Date: Thu, 11 Oct 2018 17:02:35 +0300 Subject: [PATCH] [effects/diminactive] Delete active transitions when window is deleted Summary: The Dim Inactive effect expects that the windowClosed signal always proceeds the windowDeleted signal. But in some cases that's not the case. If a window gets destroyed before becoming ready for painting, only the windowDeleted signal will be emitted. In addition to that, KWin will activate that window, which means we'll probably start a transition for it. Because this effect cannot terminate active transitions for such windows, KWin can crash in postPaintScreen. This change addresses the crash in postPaintScreen by adding extra clean up stuff in the windowDeleted slot to make sure that there are no transitions for deleted windows. The proper fix would be to not emit windowActivated signal for windows that are not ready for painting. BUG: 399612 FIXED-IN: 5.14.1 Test Plan: Ran ``` x <- seq(5, 15, length=1000) y <- dnorm(x, mean=10, sd=3) plot(x, y, type="l", lwd=1) ``` in RKWard multiple times. Reviewers: #kwin Subscribers: kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D16130 --- effects/diminactive/diminactive.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/effects/diminactive/diminactive.cpp b/effects/diminactive/diminactive.cpp index aae2c8b1b2..69ba653117 100644 --- a/effects/diminactive/diminactive.cpp +++ b/effects/diminactive/diminactive.cpp @@ -372,6 +372,12 @@ void DimInactiveEffect::windowClosed(EffectWindow *w) void DimInactiveEffect::windowDeleted(EffectWindow *w) { m_forceDim.remove(w); + + // FIXME: Sometimes we can miss the window close signal because KWin + // can activate a window that is not ready for painting and the window + // gets destroyed immediately. So, we have to remove active transitions + // for that window here, otherwise we'll crash in postPaintScreen. + m_transitions.remove(w); } void DimInactiveEffect::activeFullScreenEffectChanged()