fix iterate hashmap

master
CodeHz 4 years ago
parent 5360be5b0e
commit 6b4ed304a6

@ -195,7 +195,8 @@ pub const Registry = struct {
} }
pub fn deinit(self: *Registry) void { 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 // HACK: we dont know the Type here but we need to call deinit
var storage = @intToPtr(*Storage(u1), ptr.value); var storage = @intToPtr(*Storage(u1), ptr.value);
storage.deinit(); storage.deinit();

@ -14,7 +14,8 @@ pub const TypeStore = struct {
} }
pub fn deinit(self: *TypeStore) void { 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.allocator.free(kv.value);
} }
self.map.deinit(); self.map.deinit();

Loading…
Cancel
Save