ecs: fix segfault in Entities.deinit (#629)
Co-authored-by: Aaron Winter <wintera@Aarons-MacBook-Pro.local>
This commit is contained in:
parent
a06ac6356d
commit
72ef60c8c2
1 changed files with 11 additions and 3 deletions
|
|
@ -470,7 +470,7 @@ pub fn Entities(comptime all_components: anytype) type {
|
||||||
.len = 0,
|
.len = 0,
|
||||||
.capacity = 0,
|
.capacity = 0,
|
||||||
.columns = columns,
|
.columns = columns,
|
||||||
.block = undefined,
|
.block = &[_]u8{},
|
||||||
.hash = void_archetype_hash,
|
.hash = void_archetype_hash,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -587,7 +587,7 @@ pub fn Entities(comptime all_components: anytype) type {
|
||||||
.len = 0,
|
.len = 0,
|
||||||
.capacity = 0,
|
.capacity = 0,
|
||||||
.columns = columns,
|
.columns = columns,
|
||||||
.block = undefined,
|
.block = &[_]u8{},
|
||||||
.hash = undefined,
|
.hash = undefined,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -715,7 +715,7 @@ pub fn Entities(comptime all_components: anytype) type {
|
||||||
.len = 0,
|
.len = 0,
|
||||||
.capacity = 0,
|
.capacity = 0,
|
||||||
.columns = columns,
|
.columns = columns,
|
||||||
.block = undefined,
|
.block = &[_]u8{},
|
||||||
.hash = undefined,
|
.hash = undefined,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -867,3 +867,11 @@ test "example" {
|
||||||
// Remove an entity whenever you wish. Just be sure not to try and use it later!
|
// Remove an entity whenever you wish. Just be sure not to try and use it later!
|
||||||
try world.remove(player1);
|
try world.remove(player1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test "empty_world" {
|
||||||
|
const allocator = testing.allocator;
|
||||||
|
//-------------------------------------------------------------------------
|
||||||
|
var world = try Entities(.{}).init(allocator);
|
||||||
|
// Create a world.
|
||||||
|
defer world.deinit();
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue