diff --git a/zig-ecs/src/ecs/registry.zig b/zig-ecs/src/ecs/registry.zig index b049414..9703202 100644 --- a/zig-ecs/src/ecs/registry.zig +++ b/zig-ecs/src/ecs/registry.zig @@ -195,7 +195,8 @@ pub const Registry = struct { } pub fn deinit(self: *Registry) void { - for (self.components.items()) |ptr| { + var iter = self.components.iterator(); + while (iter.next()) |ptr| { // HACK: we dont know the Type here but we need to call deinit var storage = @intToPtr(*Storage(u1), ptr.value); storage.deinit(); diff --git a/zig-ecs/src/ecs/type_store.zig b/zig-ecs/src/ecs/type_store.zig index 21db41f..a16704d 100644 --- a/zig-ecs/src/ecs/type_store.zig +++ b/zig-ecs/src/ecs/type_store.zig @@ -14,7 +14,8 @@ pub const TypeStore = struct { } pub fn deinit(self: *TypeStore) void { - for (self.map.items()) |kv| { + var iter = self.map.iterator(); + while (iter.next()) |kv| { self.allocator.free(kv.value); } self.map.deinit();