From 28ad350b35faa3beb5da684c24886d00887ab86d Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Mon, 18 Jan 2016 11:10:40 -0700 Subject: [PATCH] Memory: remove a part of the last merge request that causes crashes in multi-threaded mode. --- glslang/Include/intermediate.h | 4 +--- glslang/MachineIndependent/Intermediate.cpp | 8 +------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/glslang/Include/intermediate.h b/glslang/Include/intermediate.h index 20d73232..cf701776 100644 --- a/glslang/Include/intermediate.h +++ b/glslang/Include/intermediate.h @@ -847,9 +847,7 @@ class TIntermAggregate : public TIntermOperator { public: TIntermAggregate() : TIntermOperator(EOpNull), userDefined(false), pragmaTable(0) { } TIntermAggregate(TOperator o) : TIntermOperator(o), pragmaTable(0) { } - // Since pragmaTable is allocated with the PoolAllocator, we - // only want to destroy it, not free the associated memory. - ~TIntermAggregate() { pragmaTable->~TPragmaTable(); } + ~TIntermAggregate() { delete pragmaTable; } virtual TIntermAggregate* getAsAggregate() { return this; } virtual const TIntermAggregate* getAsAggregate() const { return this; } virtual void setOperator(TOperator o) { op = o; } diff --git a/glslang/MachineIndependent/Intermediate.cpp b/glslang/MachineIndependent/Intermediate.cpp index 4d60dcd8..2e9fa85c 100644 --- a/glslang/MachineIndependent/Intermediate.cpp +++ b/glslang/MachineIndependent/Intermediate.cpp @@ -1613,13 +1613,7 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC void TIntermAggregate::addToPragmaTable(const TPragmaTable& pTable) { assert(!pragmaTable); - - // We allocate this with the thread-pool allocator because the destructors - // for TIntermNode's are never called. When TIntermNodes are no longer - // needed, the pool allocator destroys all memory at once without - // destruction. - void* memory = GetThreadPoolAllocator().allocate(sizeof(TPragmaTable)); - pragmaTable = new(memory) TPragmaTable(); + pragmaTable = new TPragmaTable(); *pragmaTable = pTable; }