summaryrefslogtreecommitdiff
path: root/src/protocols/SecurityContext.hpp
diff options
context:
space:
mode:
authorTom Englund <tomenglund26@gmail.com>2024-10-25 12:26:48 +0200
committerGitHub <noreply@github.com>2024-10-25 11:26:48 +0100
commitf0e023bff2f2a25ffe5ed3166f55f7274d17c6bc (patch)
treed7dc8cf3985f155f06a3acfffbea591366b742dc /src/protocols/SecurityContext.hpp
parent3cec45d82113051d35e846e5d80719d8ea0f7002 (diff)
security-context: avoid UB in C macro (#8229)
to safely use wl_container_of with a class the class has to be no virtual functions, no inheritance, and uniform access control (e.g all public) work around this by putting this into a destroywrapper struct.
Diffstat (limited to 'src/protocols/SecurityContext.hpp')
-rw-r--r--src/protocols/SecurityContext.hpp12
1 files changed, 9 insertions, 3 deletions
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
+};