From 0c8543160eef50e24654de5cda67b096e64e7591 Mon Sep 17 00:00:00 2001 From: IntegratedQuantum Date: Mon, 28 Jul 2025 17:33:08 +0200 Subject: [PATCH] Fix deinitialization order --- src/utils.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils.zig b/src/utils.zig index 44ececb2..f2557da0 100644 --- a/src/utils.zig +++ b/src/utils.zig @@ -1252,8 +1252,8 @@ pub fn PaletteCompressedRegion(T: type, size: comptime_int) type { // MARK: Pale for(0..size) |i| { newData.setValue(i, paletteMap[self.data.getValue(i)]); } - self.data.deinit(); - self.data.content.store(newData.content.load(.unordered), .release); + newData.content.store(self.data.content.swap(newData.content.load(.unordered), .release), .unordered); + newData.deinit(); self.paletteLength = self.activePaletteEntries; 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);