diff --git a/tests/partition.c b/tests/partition.c index 4688845..83df4ee 100644 --- a/tests/partition.c +++ b/tests/partition.c @@ -421,8 +421,12 @@ akerr_ErrorContext *test_reset_and_empty(char *name) TEST_ASSERT(errctx, (rec.count == 0), "%s reported %d proxies in an empty world", name, rec.count); - CATCH(errctx, spawn(&world, &shape, 0.0f, 0.0f, &proxy)); + // Build the shape before spawning from it, not after. Spawning first + // initializes the proxy from an uninitialized stack struct -- the sync + // below overwrites it, so the test still passed, and valgrind still + // reported eighteen uninitialised reads inside grid_cellrect. CATCH(errctx, akgl_collision_shape_box(&shape, &body, 0.0f)); + CATCH(errctx, spawn(&world, &shape, 0.0f, 0.0f, &proxy)); CATCH(errctx, akgl_collision_proxy_sync(proxy, &shape, 0.0f, 0.0f, 0.0f)); CATCH(errctx, world.partitioner.move(&world.partitioner, proxy));