Delay desktopPresenceChanged in EffectsHandlerImpl instead of Workspace

The signal might be emited by Workspace just before a Client gets
destroyed. In that case the argument carried by the queued event is no
longer valid and causes problems. In EffectsHandlerImpl we can queue
it without problems as the EffectWindow also stays valid if the Client
gets destroyed. The referenced Deleted gets destroyed with a deleteLater,
thus will be after the signal is emitted.

BUG: 347490
REVIEW: 123729
This commit is contained in:
Martin Gräßlin 2015-05-12 11:33:03 +02:00
parent e42c874859
commit 30e6ae34d7
2 changed files with 6 additions and 2 deletions

View file

@ -235,7 +235,11 @@ EffectsHandlerImpl::EffectsHandlerImpl(Compositor *compositor, Scene *scene)
if (!c->effectWindow()) {
return;
}
emit desktopPresenceChanged(c->effectWindow(), old, c->desktop());
// 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()));
}
);
connect(ws, &Workspace::clientAdded, this,

View file

@ -466,7 +466,7 @@ Client* Workspace::createClient(xcb_window_t w, bool is_mapped)
connect(c, SIGNAL(geometryShapeChanged(KWin::Toplevel*,QRect)), m_compositor, SLOT(checkUnredirect()));
connect(c, SIGNAL(blockingCompositingChanged(KWin::Client*)), m_compositor, SLOT(updateCompositeBlocking(KWin::Client*)));
connect(c, SIGNAL(clientFullScreenSet(KWin::Client*,bool,bool)), ScreenEdges::self(), SIGNAL(checkBlocking()));
connect(c, &Client::desktopPresenceChanged, this, &Workspace::desktopPresenceChanged, Qt::QueuedConnection);
connect(c, &Client::desktopPresenceChanged, this, &Workspace::desktopPresenceChanged);
if (!c->manage(w, is_mapped)) {
Client::deleteClient(c);
return NULL;