From 157841e5245c8ac0b649a15a68b195fd79276f30 Mon Sep 17 00:00:00 2001 From: Christian Kern Date: Thu, 29 Oct 2015 12:55:30 +0100 Subject: [PATCH] fixed wrong ordering destruction. First destruct, than deallocate. --- containers_cpp/include/embb/containers/internal/lock_free_tree_value_pool-inl.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/containers_cpp/include/embb/containers/internal/lock_free_tree_value_pool-inl.h b/containers_cpp/include/embb/containers/internal/lock_free_tree_value_pool-inl.h index 73485e4..9747044 100644 --- a/containers_cpp/include/embb/containers/internal/lock_free_tree_value_pool-inl.h +++ b/containers_cpp/include/embb/containers/internal/lock_free_tree_value_pool-inl.h @@ -254,21 +254,20 @@ LockFreeTreeValuePool:: size_t tree_size_unsigned = static_cast(tree_size); size_t real_size_unsigned = static_cast(real_size); - poolAllocator.deallocate(pool, real_size_unsigned); - // invoke destructor for each pool element for (size_t i = 0; i != real_size_unsigned; ++i) { pool[i].~Atomic(); } - treeAllocator.deallocate(tree, tree_size_unsigned); + poolAllocator.deallocate(pool, real_size_unsigned); // invoke destructor for each tree element for (size_t i = 0; i != tree_size_unsigned; ++i) { tree[i].~Atomic(); } -} + treeAllocator.deallocate(tree, tree_size_unsigned); +} } // namespace containers } // namespace embb -- libgit2 0.26.0