diff --git a/include/aquamarine/allocator/Allocator.hpp b/include/aquamarine/allocator/Allocator.hpp index 7567dff..975f348 100644 --- a/include/aquamarine/allocator/Allocator.hpp +++ b/include/aquamarine/allocator/Allocator.hpp @@ -16,6 +16,7 @@ namespace Aquamarine { class IAllocator { public: + virtual ~IAllocator() = default; virtual Hyprutils::Memory::CSharedPointer acquire(const SAllocatorBufferParams& params, Hyprutils::Memory::CSharedPointer swapchain) = 0; virtual Hyprutils::Memory::CSharedPointer getBackend() = 0; }; diff --git a/include/aquamarine/allocator/GBM.hpp b/include/aquamarine/allocator/GBM.hpp index 40b682b..3d4b416 100644 --- a/include/aquamarine/allocator/GBM.hpp +++ b/include/aquamarine/allocator/GBM.hpp @@ -35,6 +35,7 @@ namespace Aquamarine { class CGBMAllocator : public IAllocator { public: + ~CGBMAllocator(); static Hyprutils::Memory::CSharedPointer create(int drmfd_, Hyprutils::Memory::CWeakPointer backend_); virtual Hyprutils::Memory::CSharedPointer acquire(const SAllocatorBufferParams& params, Hyprutils::Memory::CSharedPointer swapchain_); diff --git a/src/allocator/GBM.cpp b/src/allocator/GBM.cpp index 7c93c5e..b533e9b 100644 --- a/src/allocator/GBM.cpp +++ b/src/allocator/GBM.cpp @@ -183,6 +183,11 @@ SDMABUFAttrs Aquamarine::CGBMBuffer::dmabuf() { return attrs; } +CGBMAllocator::~CGBMAllocator() { + if (gbmDevice) + gbm_device_destroy(gbmDevice); +} + SP Aquamarine::CGBMAllocator::create(int drmfd_, Hyprutils::Memory::CWeakPointer backend_) { uint64_t capabilities = 0; if (drmGetCap(drmfd_, DRM_CAP_PRIME, &capabilities) || !(capabilities & DRM_PRIME_CAP_EXPORT)) {