From c9cc4845b9561784df79491b30552dbc1a6bae07 Mon Sep 17 00:00:00 2001 From: Jeremy Hayes Date: Mon, 4 Oct 2021 22:10:00 -0600 Subject: [PATCH] Return new allocator for copied containers Fix #2760. Implement the optional function select_on_container_copy_contruction to return a default-contructed allocator for containers that are copy-constructed. This gives copy-constructed containers a pool allocator for the current thead. There may be a similar problem with the copy contructor which takes allocators of type "Other" but, in practice, there is only one place where this is being used and the allocators are always the same. (i.e. executing from the same thread) --- glslang/Include/PoolAlloc.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/glslang/Include/PoolAlloc.h b/glslang/Include/PoolAlloc.h index b8eccb8..1f5cac7 100644 --- a/glslang/Include/PoolAlloc.h +++ b/glslang/Include/PoolAlloc.h @@ -306,6 +306,8 @@ public: TPoolAllocator& getAllocator() const { return allocator; } + pool_allocator select_on_container_copy_construction() const { return pool_allocator{}; } + protected: pool_allocator& operator=(const pool_allocator&) { return *this; } TPoolAllocator& allocator; -- 2.7.4