Fix deinitialization order

This commit is contained in:
IntegratedQuantum 2025-07-28 17:33:08 +02:00
parent 22655b337f
commit 0c8543160e

View File

@ -1252,8 +1252,8 @@ pub fn PaletteCompressedRegion(T: type, size: comptime_int) type { // MARK: Pale
for(0..size) |i| { for(0..size) |i| {
newData.setValue(i, paletteMap[self.data.getValue(i)]); newData.setValue(i, paletteMap[self.data.getValue(i)]);
} }
self.data.deinit(); newData.content.store(self.data.content.swap(newData.content.load(.unordered), .release), .unordered);
self.data.content.store(newData.content.load(.unordered), .release); newData.deinit();
self.paletteLength = self.activePaletteEntries; self.paletteLength = self.activePaletteEntries;
self.palette = main.globalAllocator.realloc(self.palette, @as(usize, 1) << self.data.content.load(.unordered).bitSize); self.palette = main.globalAllocator.realloc(self.palette, @as(usize, 1) << self.data.content.load(.unordered).bitSize);
self.paletteOccupancy = main.globalAllocator.realloc(self.paletteOccupancy, @as(usize, 1) << self.data.content.load(.unordered).bitSize); self.paletteOccupancy = main.globalAllocator.realloc(self.paletteOccupancy, @as(usize, 1) << self.data.content.load(.unordered).bitSize);