From 3dcd311ccec0f4c9ffbe4239b09e9bba67ef159f Mon Sep 17 00:00:00 2001 From: kingscallop <54776947+kingscallop@users.noreply.github.com> Date: Sun, 1 May 2022 17:01:53 +0100 Subject: [PATCH] Fixed invalid reference on Octree The call to addToCell() can reallocate the Array 'cells', invalidating the 'parent' reference. --- src/Core/SPK_Octree.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Core/SPK_Octree.cpp b/src/Core/SPK_Octree.cpp index bc5bc195..894fb465 100644 --- a/src/Core/SPK_Octree.cpp +++ b/src/Core/SPK_Octree.cpp @@ -211,6 +211,6 @@ namespace SPK for (int x = minIndexX; x <= maxIndexX; ++x) for (int y = minIndexY; y <= maxIndexY; ++y) for (int z = minIndexZ; z <= maxIndexZ; ++z) - addToCell(parent.children[(x << 2) | (y << 1) | z],particleIndex,maxLevel); + addToCell(cells[parentIndex].children[(x << 2) | (y << 1) | z],particleIndex,maxLevel); } }