mirror of
https://github.com/hyprwm/aquamarine.git
synced 2024-11-17 03:46:00 +01:00
allocator: add missing virtual destructor (#3)
add missing virtual destructor to base class and free gbm device on destruction of CGBMAllocator
This commit is contained in:
parent
29c415a4f5
commit
263cb161da
3 changed files with 7 additions and 0 deletions
|
@ -16,6 +16,7 @@ namespace Aquamarine {
|
|||
|
||||
class IAllocator {
|
||||
public:
|
||||
virtual ~IAllocator() = default;
|
||||
virtual Hyprutils::Memory::CSharedPointer<IBuffer> acquire(const SAllocatorBufferParams& params, Hyprutils::Memory::CSharedPointer<CSwapchain> swapchain) = 0;
|
||||
virtual Hyprutils::Memory::CSharedPointer<CBackend> getBackend() = 0;
|
||||
};
|
||||
|
|
|
@ -35,6 +35,7 @@ namespace Aquamarine {
|
|||
|
||||
class CGBMAllocator : public IAllocator {
|
||||
public:
|
||||
~CGBMAllocator();
|
||||
static Hyprutils::Memory::CSharedPointer<CGBMAllocator> create(int drmfd_, Hyprutils::Memory::CWeakPointer<CBackend> backend_);
|
||||
|
||||
virtual Hyprutils::Memory::CSharedPointer<IBuffer> acquire(const SAllocatorBufferParams& params, Hyprutils::Memory::CSharedPointer<CSwapchain> swapchain_);
|
||||
|
|
|
@ -183,6 +183,11 @@ SDMABUFAttrs Aquamarine::CGBMBuffer::dmabuf() {
|
|||
return attrs;
|
||||
}
|
||||
|
||||
CGBMAllocator::~CGBMAllocator() {
|
||||
if (gbmDevice)
|
||||
gbm_device_destroy(gbmDevice);
|
||||
}
|
||||
|
||||
SP<CGBMAllocator> Aquamarine::CGBMAllocator::create(int drmfd_, Hyprutils::Memory::CWeakPointer<CBackend> backend_) {
|
||||
uint64_t capabilities = 0;
|
||||
if (drmGetCap(drmfd_, DRM_CAP_PRIME, &capabilities) || !(capabilities & DRM_PRIME_CAP_EXPORT)) {
|
||||
|
|
Loading…
Reference in a new issue