mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-25 03:45:59 +01:00
security-context: close client fds after disconnect
This commit is contained in:
parent
da86aac0f5
commit
4e41cda27e
2 changed files with 7 additions and 5 deletions
|
@ -14,8 +14,8 @@ static int onCloseFdEvent(int fd, uint32_t mask, void* data) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SP<CSecurityContextSandboxedClient> CSecurityContextSandboxedClient::create(int clientFD) {
|
SP<CSecurityContextSandboxedClient> CSecurityContextSandboxedClient::create(int clientFD_) {
|
||||||
auto p = SP<CSecurityContextSandboxedClient>(new CSecurityContextSandboxedClient(clientFD));
|
auto p = SP<CSecurityContextSandboxedClient>(new CSecurityContextSandboxedClient(clientFD_));
|
||||||
if (!p->client)
|
if (!p->client)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
return p;
|
return p;
|
||||||
|
@ -26,7 +26,7 @@ static void onSecurityContextClientDestroy(wl_listener* l, void* d) {
|
||||||
client->onDestroy();
|
client->onDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
CSecurityContextSandboxedClient::CSecurityContextSandboxedClient(int clientFD) {
|
CSecurityContextSandboxedClient::CSecurityContextSandboxedClient(int clientFD_) : clientFD(clientFD_) {
|
||||||
client = wl_client_create(g_pCompositor->m_sWLDisplay, clientFD);
|
client = wl_client_create(g_pCompositor->m_sWLDisplay, clientFD);
|
||||||
if (!client)
|
if (!client)
|
||||||
return;
|
return;
|
||||||
|
@ -37,6 +37,7 @@ CSecurityContextSandboxedClient::CSecurityContextSandboxedClient(int clientFD) {
|
||||||
|
|
||||||
CSecurityContextSandboxedClient::~CSecurityContextSandboxedClient() {
|
CSecurityContextSandboxedClient::~CSecurityContextSandboxedClient() {
|
||||||
wl_list_remove(&destroyListener.link);
|
wl_list_remove(&destroyListener.link);
|
||||||
|
close(clientFD);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSecurityContextSandboxedClient::onDestroy() {
|
void CSecurityContextSandboxedClient::onDestroy() {
|
||||||
|
|
|
@ -47,9 +47,10 @@ class CSecurityContextSandboxedClient {
|
||||||
wl_listener destroyListener;
|
wl_listener destroyListener;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CSecurityContextSandboxedClient(int clientFD);
|
CSecurityContextSandboxedClient(int clientFD_);
|
||||||
|
|
||||||
wl_client* client = nullptr;
|
wl_client* client = nullptr;
|
||||||
|
int clientFD = -1;
|
||||||
|
|
||||||
friend class CSecurityContextProtocol;
|
friend class CSecurityContextProtocol;
|
||||||
friend class CSecurityContext;
|
friend class CSecurityContext;
|
||||||
|
|
Loading…
Reference in a new issue