summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2019-11-07 09:56:55 +0100
committerJohan Klokkhammer Helsing <johan.helsing@qt.io>2019-11-07 15:01:42 +0100
commit2493c8b6600f2617848007ee9592c71361b432fe (patch)
tree9e9e70afbdcd654ee5db00306f9a99789f2bf8e9
parent57c28f461a066c03ef8ae3f823c040fa91876fb8 (diff)
Fix race condition in tests on xdg_toplevel configure5.13
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>
-rw-r--r--tests/auto/client/shared/mockcompositor.cpp11
-rw-r--r--tests/auto/client/shared/xdgshell.cpp2
2 files changed, 5 insertions, 8 deletions
diff --git a/tests/auto/client/shared/mockcompositor.cpp b/tests/auto/client/shared/mockcompositor.cpp
index 6b9af429..0711c5d8 100644
--- a/tests/auto/client/shared/mockcompositor.cpp
+++ b/tests/auto/client/shared/mockcompositor.cpp
@@ -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());
}
diff --git a/tests/auto/client/shared/xdgshell.cpp b/tests/auto/client/shared/xdgshell.cpp
index 13acc01e..72582f48 100644
--- a/tests/auto/client/shared/xdgshell.cpp
+++ b/tests/auto/client/shared/xdgshell.cpp
@@ -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;