mirror of
https://github.com/PixelGuys/Cubyz.git
synced 2025-09-08 19:50:23 -04:00
Fix memory leak when a parent of a sub biome couldn't be found
This commit is contained in:
parent
4992176274
commit
71e0554ed2
@ -670,16 +670,16 @@ pub fn finishLoading() void {
|
||||
}
|
||||
var subBiomeIterator = unfinishedSubBiomes.iterator();
|
||||
while(subBiomeIterator.next()) |subBiomeData| {
|
||||
const subBiomeDataList = subBiomeData.value_ptr;
|
||||
defer subBiomeDataList.deinit(main.globalAllocator);
|
||||
const parentBiome = biomesById.get(subBiomeData.key_ptr.*) orelse {
|
||||
std.log.warn("Couldn't find biome with id {s}. Cannot add sub-biomes.", .{subBiomeData.key_ptr.*});
|
||||
continue;
|
||||
};
|
||||
const subBiomeDataList = subBiomeData.value_ptr;
|
||||
for(subBiomeDataList.items) |item| {
|
||||
parentBiome.subBiomeTotalChance += item.chance;
|
||||
}
|
||||
parentBiome.subBiomes = .initFromContext(main.globalAllocator, subBiomeDataList.items);
|
||||
subBiomeDataList.deinit(main.globalAllocator);
|
||||
}
|
||||
unfinishedSubBiomes.clearAndFree(main.globalAllocator.allocator);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user