Fix race condition in tests on xdg_toplevel configure

Tests should not use non-direct connections, as that means tests can run when
the compositor is not locked.

Change-Id: I7b1f0e3bb866db540f72307ad96f778ec0edd7ee
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
This commit is contained in:
Johan Klokkhammer Helsing 2019-11-07 09:56:55 +01:00
parent 9d186a4dd5
commit bf1336af6a
2 changed files with 5 additions and 8 deletions

View File

@ -58,13 +58,10 @@ DefaultCompositor::DefaultCompositor()
});
});
QObject::connect(get<XdgWmBase>(), &XdgWmBase::toplevelCreated, [&] (XdgToplevel *toplevel) {
// Needed because lambdas don't support Qt::DirectConnection
exec([&]{
if (m_config.autoConfigure)
toplevel->sendCompleteConfigure();
});
});
QObject::connect(get<XdgWmBase>(), &XdgWmBase::toplevelCreated, get<XdgWmBase>(), [&] (XdgToplevel *toplevel) {
if (m_config.autoConfigure)
toplevel->sendCompleteConfigure();
}, Qt::DirectConnection);
}
Q_ASSERT(isClean());
}

View File

@ -83,7 +83,7 @@ XdgSurface::XdgSurface(XdgWmBase *xdgWmBase, Surface *surface, wl_client *client
{
QVERIFY(!surface->m_pending.buffer);
QVERIFY(!surface->m_committed.buffer);
connect(this, &XdgSurface::toplevelCreated, xdgWmBase, &XdgWmBase::toplevelCreated);
connect(this, &XdgSurface::toplevelCreated, xdgWmBase, &XdgWmBase::toplevelCreated, Qt::DirectConnection);
connect(surface, &Surface::attach, this, &XdgSurface::verifyConfigured);
connect(surface, &Surface::commit, this, [this] {
m_committed = m_pending;