From 2a995cbf386a5a8d43f7288cac5fc836f2afa6f9 Mon Sep 17 00:00:00 2001 From: assiduous Date: Thu, 31 Oct 2024 15:54:40 -0700 Subject: [PATCH] ProxyDataBlob: added option to keep data container alive --- Common/interface/ProxyDataBlob.hpp | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/Common/interface/ProxyDataBlob.hpp b/Common/interface/ProxyDataBlob.hpp index 8f24b32bd..33b778645 100644 --- a/Common/interface/ProxyDataBlob.hpp +++ b/Common/interface/ProxyDataBlob.hpp @@ -43,18 +43,26 @@ class ProxyDataBlob : public ObjectBase public: typedef ObjectBase TBase; - ProxyDataBlob(IReferenceCounters* pRefCounters, void* pData, size_t Size) : + ProxyDataBlob(IReferenceCounters* pRefCounters, + void* pData, + size_t Size, + IObject* pDataContainer = nullptr) : TBase{pRefCounters}, m_pData{pData}, m_pConstData{pData}, - m_Size{Size} + m_Size{Size}, + m_pDataContainer{pDataContainer} {} - ProxyDataBlob(IReferenceCounters* pRefCounters, const void* pData, size_t Size) : + ProxyDataBlob(IReferenceCounters* pRefCounters, + const void* pData, + size_t Size, + IObject* pDataContainer = nullptr) : TBase{pRefCounters}, m_pData{nullptr}, m_pConstData{pData}, - m_Size{Size} + m_Size{Size}, + m_pDataContainer{pDataContainer} {} template @@ -92,9 +100,10 @@ class ProxyDataBlob : public ObjectBase } private: - void* const m_pData; - const void* const m_pConstData; - const size_t m_Size; + void* const m_pData; + const void* const m_pConstData; + const size_t m_Size; + RefCntAutoPtr m_pDataContainer; }; } // namespace Diligent