From de15b87ea732e9bdbdeb2fa4670f32cccee3cec3 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Thu, 16 May 2024 12:27:39 +0300 Subject: [PATCH] wayland: Fix security context failing to create a client wl_client_create() can fail. --- src/wayland/display.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/wayland/display.cpp b/src/wayland/display.cpp index 8cf8b23794..59d786c35e 100644 --- a/src/wayland/display.cpp +++ b/src/wayland/display.cpp @@ -270,12 +270,18 @@ SecurityContext::~SecurityContext() void SecurityContext::onListenFdActivated(QSocketDescriptor socketDescriptor) { - int clientFd = accept4(socketDescriptor, nullptr, nullptr, SOCK_CLOEXEC); + const int clientFd = accept4(socketDescriptor, nullptr, nullptr, SOCK_CLOEXEC); if (clientFd < 0) { qCWarning(KWIN_CORE) << "Failed to accept client from security listen FD"; return; } + auto client = m_display->createClient(clientFd); + if (!client) { + close(clientFd); + return; + } + client->setSecurityContextAppId(m_appId); }