[wayland] Ensure to not call into x11 on Compositor tear-down

During Compositor tear down Xwayland is already destroyed. Thus it
doesn't make sense to try to delete the support properties: either
it freezes in xcb or it crashes because the connection is null.

At the same time we also ensure that the connection internally is
reset to null. Note: the one in kwinglobals.h caches and could cause
use-after-free errors. Any tear-down code must be migrated to
kwinApp()->x11Connection().
icc-effect-5.14.5
Martin Gräßlin 2015-11-10 13:54:26 +01:00
parent acb0dfd893
commit f75e53af60
3 changed files with 7 additions and 3 deletions

View File

@ -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();

View File

@ -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);
}
}
}

View File

@ -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();