diff --git a/autotests/wayland/kwin_wayland_test.cpp b/autotests/wayland/kwin_wayland_test.cpp index 676bedc72c..88facd1faf 100644 --- a/autotests/wayland/kwin_wayland_test.cpp +++ b/autotests/wayland/kwin_wayland_test.cpp @@ -56,6 +56,7 @@ WaylandTestApplication::~WaylandTestApplication() Xcb::setInputFocus(XCB_INPUT_FOCUS_POINTER_ROOT); destroyAtoms(); xcb_disconnect(x11Connection()); + setX11Connection(nullptr); } if (m_xwaylandProcess) { m_xwaylandProcess->terminate(); diff --git a/composite.cpp b/composite.cpp index 2ed44ceaf4..77d66d4ae5 100644 --- a/composite.cpp +++ b/composite.cpp @@ -443,9 +443,11 @@ void Compositor::deleteUnusedSupportProperties() m_unusedSupportPropertyTimer.start(); return; } - foreach (const xcb_atom_t &atom, m_unusedSupportProperties) { - // remove property from root window - xcb_delete_property(connection(), rootWindow(), atom); + if (kwinApp()->x11Connection()) { + foreach (const xcb_atom_t &atom, m_unusedSupportProperties) { + // remove property from root window + xcb_delete_property(connection(), rootWindow(), atom); + } } } diff --git a/main_wayland.cpp b/main_wayland.cpp index 946598f44f..41fc7e5158 100644 --- a/main_wayland.cpp +++ b/main_wayland.cpp @@ -80,6 +80,7 @@ ApplicationWayland::~ApplicationWayland() Xcb::setInputFocus(XCB_INPUT_FOCUS_POINTER_ROOT); destroyAtoms(); xcb_disconnect(x11Connection()); + setX11Connection(nullptr); } if (m_xwaylandProcess) { m_xwaylandProcess->terminate();