From 6d60f01ad96abae030d3f9aa43349c8e479f0014 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Tue, 26 Apr 2016 12:47:02 +0200 Subject: [PATCH] Skip DontCrashEmptyDecorationTest if we don't have a /dev/dri/card0 device Without the /dev/dri/card0 mesa fails to initialize egl and the test fails. In order to silence the failure till the system provides the device file, we better skip the test. A nullptr crash in that case is fixed in WaylandServer tear-down. --- autotests/wayland/dont_crash_empty_deco.cpp | 3 +++ wayland_server.cpp | 8 +++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/autotests/wayland/dont_crash_empty_deco.cpp b/autotests/wayland/dont_crash_empty_deco.cpp index 1b74bf878..7ae4a2e1f 100644 --- a/autotests/wayland/dont_crash_empty_deco.cpp +++ b/autotests/wayland/dont_crash_empty_deco.cpp @@ -70,6 +70,9 @@ private: void DontCrashEmptyDecorationTest::initTestCase() { + if (!QFile::exists(QStringLiteral("/dev/dri/card0"))) { + QSKIP("Needs a dri device"); + } qRegisterMetaType(); qRegisterMetaType(); QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); diff --git a/wayland_server.cpp b/wayland_server.cpp index 8d205c591..939cf0ab4 100644 --- a/wayland_server.cpp +++ b/wayland_server.cpp @@ -97,9 +97,11 @@ void WaylandServer::terminateClientConnections() { destroyInternalConnection(); destroyInputMethodConnection(); - const auto connections = m_display->connections(); - for (auto it = connections.begin(); it != connections.end(); ++it) { - (*it)->destroy(); + if (m_display) { + const auto connections = m_display->connections(); + for (auto it = connections.begin(); it != connections.end(); ++it) { + (*it)->destroy(); + } } } -- GitLab