summaryrefslogtreecommitdiff
path: root/src/protocols
diff options
context:
space:
mode:
Diffstat (limited to 'src/protocols')
-rw-r--r--src/protocols/SecurityContext.cpp12
-rw-r--r--src/protocols/SecurityContext.hpp12
2 files changed, 17 insertions, 7 deletions
diff --git a/src/protocols/SecurityContext.cpp b/src/protocols/SecurityContext.cpp
index b42c3a97..13428b91 100644
--- a/src/protocols/SecurityContext.cpp
+++ b/src/protocols/SecurityContext.cpp
@@ -22,7 +22,8 @@ SP<CSecurityContextSandboxedClient> CSecurityContextSandboxedClient::create(int
}
static void onSecurityContextClientDestroy(wl_listener* l, void* d) {
- CSecurityContextSandboxedClient* client = wl_container_of(l, client, destroyListener);
+ CSecurityContextSandboxedClientDestroyWrapper* wrap = wl_container_of(l, wrap, listener);
+ CSecurityContextSandboxedClient* client = wrap->parent;
client->onDestroy();
}
@@ -31,12 +32,15 @@ CSecurityContextSandboxedClient::CSecurityContextSandboxedClient(int clientFD_)
if (!client)
return;
- destroyListener.notify = ::onSecurityContextClientDestroy;
- wl_client_add_destroy_late_listener(client, &destroyListener);
+ wl_list_init(&destroyListener.listener.link);
+ destroyListener.listener.notify = ::onSecurityContextClientDestroy;
+ destroyListener.parent = this;
+ wl_client_add_destroy_late_listener(client, &destroyListener.listener);
}
CSecurityContextSandboxedClient::~CSecurityContextSandboxedClient() {
- wl_list_remove(&destroyListener.link);
+ wl_list_remove(&destroyListener.listener.link);
+ wl_list_init(&destroyListener.listener.link);
close(clientFD);
}
diff --git a/src/protocols/SecurityContext.hpp b/src/protocols/SecurityContext.hpp
index 76313bcf..63f58bde 100644
--- a/src/protocols/SecurityContext.hpp
+++ b/src/protocols/SecurityContext.hpp
@@ -37,14 +37,20 @@ class CSecurityContextManagerResource {
SP<CWpSecurityContextManagerV1> resource;
};
+class CSecurityContextSandboxedClient;
+struct CSecurityContextSandboxedClientDestroyWrapper {
+ wl_listener listener;
+ CSecurityContextSandboxedClient* parent = nullptr;
+};
+
class CSecurityContextSandboxedClient {
public:
static SP<CSecurityContextSandboxedClient> create(int clientFD);
~CSecurityContextSandboxedClient();
- void onDestroy();
+ void onDestroy();
- wl_listener destroyListener;
+ CSecurityContextSandboxedClientDestroyWrapper destroyListener;
private:
CSecurityContextSandboxedClient(int clientFD_);
@@ -81,4 +87,4 @@ class CSecurityContextProtocol : public IWaylandProtocol {
namespace PROTO {
inline UP<CSecurityContextProtocol> securityContext;
-}; \ No newline at end of file
+};