fix occassional crash caused by needlessly delayed signals (bko#363224)

As pointed out by the Valgrind trace in #363224, delaying the signal causes
the EffectWindow* argument to become invalid before the connected slot is
called (this is because Qt discards only delayed signal->slot calls where
the receiver gets deleted meanwhile, not the sender and definitely not
a random argument.
If the supposed glitches really happen, they should get fixed correctly,
and for all cases (I doubt only desktop number would be involved but
not e.g. shaded or minimized states).

https://phabricator.kde.org/D5164

CCBUG: 363224
This commit is contained in:
Luboš Luňák 2017-03-17 16:32:34 +01:00 committed by Martin Flöser
parent 32939fa7b5
commit 55f169d1c3

View file

@ -141,11 +141,7 @@ EffectsHandlerImpl::EffectsHandlerImpl(Compositor *compositor, Scene *scene)
if (!c->effectWindow()) {
return;
}
// the visibility update hasn't happed yet, thus the signal is delayed to prevent glitches, see also BUG 347490
QMetaObject::invokeMethod(this, "desktopPresenceChanged", Qt::QueuedConnection,
Q_ARG(KWin::EffectWindow*, c->effectWindow()),
Q_ARG(int, old),
Q_ARG(int, c->desktop()));
emit desktopPresenceChanged(c->effectWindow(), old, c->desktop());
}
);
connect(ws, &Workspace::clientAdded, this,