diff options
author | Vaxry <[email protected]> | 2024-08-07 16:08:50 +0200 |
---|---|---|
committer | Vaxry <[email protected]> | 2024-08-07 16:08:50 +0200 |
commit | 99e9cb510777c62f56c94137b302186d4d9506d8 (patch) | |
tree | a894d044ffe5601eb4be32e9c603a10ac9670bbb | |
parent | f36c625e37f8913d8da38365a4783948f2217f02 (diff) | |
download | Hyprland-99e9cb510777c62f56c94137b302186d4d9506d8.tar.gz Hyprland-99e9cb510777c62f56c94137b302186d4d9506d8.zip |
drm-syncobj: fixup fd leak with timelines
-rw-r--r-- | src/protocols/DRMSyncobj.cpp | 5 | ||||
-rw-r--r-- | src/protocols/DRMSyncobj.hpp | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/protocols/DRMSyncobj.cpp b/src/protocols/DRMSyncobj.cpp index 8b0330de..37e6d0f1 100644 --- a/src/protocols/DRMSyncobj.cpp +++ b/src/protocols/DRMSyncobj.cpp @@ -114,6 +114,11 @@ CDRMSyncobjTimelineResource::CDRMSyncobjTimelineResource(SP<CWpLinuxDrmSyncobjTi } } +CDRMSyncobjTimelineResource::~CDRMSyncobjTimelineResource() { + if (fd >= 0) + close(fd); +} + SP<CDRMSyncobjTimelineResource> CDRMSyncobjTimelineResource::fromResource(wl_resource* res) { auto data = (CDRMSyncobjTimelineResource*)(((CWpLinuxDrmSyncobjTimelineV1*)wl_resource_get_user_data(res))->data()); return data ? data->self.lock() : nullptr; diff --git a/src/protocols/DRMSyncobj.hpp b/src/protocols/DRMSyncobj.hpp index 25dc10c1..bc89a3d3 100644 --- a/src/protocols/DRMSyncobj.hpp +++ b/src/protocols/DRMSyncobj.hpp @@ -34,6 +34,7 @@ class CDRMSyncobjSurfaceResource { class CDRMSyncobjTimelineResource { public: CDRMSyncobjTimelineResource(SP<CWpLinuxDrmSyncobjTimelineV1> resource_, int fd_); + ~CDRMSyncobjTimelineResource(); static SP<CDRMSyncobjTimelineResource> fromResource(wl_resource*); bool good(); |