Commit 93cfd297 authored by Stefan Becker's avatar Stefan Becker Committed by David Edmundson
Browse files

X11: fix kded xcb resource leak

This fixes commit 579358f5

XOpenDisplay() internally calls xcb_connect(), creating a new XCB client
connection. This means that on every KScreen configuration change event
the kded5 process creates a new connection until XCB runs into the hard
limit of 256 of clients, leading to the dreaded "Maximum number of
clients reached" error.

Re-use the display from QX11Info instead of calling XOpenDisplay().

BUG: 453280


(cherry picked from commit 0270a493)
parent ff8dc215
Pipeline #182917 passed with stage
in 2 minutes and 42 seconds
......@@ -361,6 +361,14 @@ void KScreenDaemon::alignX11TouchScreen()
if (qGuiApp->platformName() != QStringLiteral("xcb")) {
return;
}
auto *display = QX11Info::display();
if (!display) {
return;
}
auto *connection = QX11Info::connection();
if (!connection) {
return;
}
const QRect totalRect(QPoint(0, 0), m_monitoredConfig->data()->screen()->currentSize());
QRect internalOutputRect;
......@@ -411,15 +419,6 @@ void KScreenDaemon::alignX11TouchScreen()
break;
}
auto *display = XOpenDisplay(nullptr);
if (!display) {
return;
}
auto *connection = QX11Info::connection();
if (!connection) {
return;
}
auto getAtom = [](xcb_connection_t *connection, const char *name) {
auto cookie = xcb_intern_atom(connection, true, strlen(name), name);
auto reply = xcb_intern_atom_reply(connection, cookie, nullptr);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment