From 99e9cb510777c62f56c94137b302186d4d9506d8 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Wed, 7 Aug 2024 16:08:50 +0200 Subject: [PATCH] drm-syncobj: fixup fd leak with timelines --- src/protocols/DRMSyncobj.cpp | 5 +++++ src/protocols/DRMSyncobj.hpp | 1 + 2 files changed, 6 insertions(+) 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= 0) + close(fd); +} + SP 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 resource_, int fd_); + ~CDRMSyncobjTimelineResource(); static SP fromResource(wl_resource*); bool good();