summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsTools
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2020-12-08 00:26:32 +0000
committerassiduous <assiduous@diligentgraphics.com>2020-12-08 00:26:32 +0000
commitf529533fdb9023a5421a1b2d3b3e524ac8437f8c (patch)
tree0b13aa68ec88ad1c0d66a655f7c5c0b0728c484d /Graphics/GraphicsTools
parentFixed potential threading issue in BufferSuballocatorImpl (diff)
downloadDiligentCore-f529533fdb9023a5421a1b2d3b3e524ac8437f8c.tar.gz
DiligentCore-f529533fdb9023a5421a1b2d3b3e524ac8437f8c.zip
Fixed issue with the last reference to TextureAtlasSuballocation and BufferSuballocation
Diffstat (limited to 'Graphics/GraphicsTools')
-rw-r--r--Graphics/GraphicsTools/src/BufferSuballocator.cpp12
-rw-r--r--Graphics/GraphicsTools/src/DynamicTextureAtlas.cpp12
2 files changed, 24 insertions, 0 deletions
diff --git a/Graphics/GraphicsTools/src/BufferSuballocator.cpp b/Graphics/GraphicsTools/src/BufferSuballocator.cpp
index 5f1f5cfd..7f59edcd 100644
--- a/Graphics/GraphicsTools/src/BufferSuballocator.cpp
+++ b/Graphics/GraphicsTools/src/BufferSuballocator.cpp
@@ -68,6 +68,18 @@ public:
IMPLEMENT_QUERY_INTERFACE_IN_PLACE(IID_BufferSuballocation, TBase)
+ virtual Atomics::Long DILIGENT_CALL_TYPE Release() override final
+ {
+ RefCntAutoPtr<BufferSuballocatorImpl> pParent;
+ return TBase::Release(
+ [&]() //
+ {
+ // We must keep parent alive while the object is being destroyed because
+ // it keeps the object allocator.
+ pParent = m_pParentAllocator;
+ });
+ }
+
virtual Uint32 GetOffset() const override final
{
return m_Offset;
diff --git a/Graphics/GraphicsTools/src/DynamicTextureAtlas.cpp b/Graphics/GraphicsTools/src/DynamicTextureAtlas.cpp
index 2c5fcc2a..6881decf 100644
--- a/Graphics/GraphicsTools/src/DynamicTextureAtlas.cpp
+++ b/Graphics/GraphicsTools/src/DynamicTextureAtlas.cpp
@@ -69,6 +69,18 @@ public:
IMPLEMENT_QUERY_INTERFACE_IN_PLACE(IID_TextureAtlasSuballocation, TBase)
+ virtual Atomics::Long DILIGENT_CALL_TYPE Release() override final
+ {
+ RefCntAutoPtr<DynamicTextureAtlasImpl> pAtlas;
+ return TBase::Release(
+ [&]() //
+ {
+ // We must keep the atlas alive while the object is being destroyed because
+ // the atlas keeps the object allocator.
+ pAtlas = m_pParentAtlas;
+ });
+ }
+
virtual uint2 GetOrigin() const override final;
virtual Uint32 GetSlice() const override final