From 6007b95926d9b14f6a4c8090ff29c51b916b9fa2 Mon Sep 17 00:00:00 2001 From: Corwin Date: Mon, 3 Apr 2023 02:43:27 +0100 Subject: [PATCH] deallocate palettes --- agb/src/display/object/sprites/sprite_allocator.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/agb/src/display/object/sprites/sprite_allocator.rs b/agb/src/display/object/sprites/sprite_allocator.rs index 207186ac..caa5e38b 100644 --- a/agb/src/display/object/sprites/sprite_allocator.rs +++ b/agb/src/display/object/sprites/sprite_allocator.rs @@ -81,6 +81,12 @@ struct PaletteVramData { location: Location, } +impl Drop for PaletteVramData { + fn drop(&mut self) { + unsafe { PALETTE_ALLOCATOR.dealloc(self.location.as_palette_ptr(), Palette16::layout()) } + } +} + #[derive(Debug)] pub struct PaletteVram { data: Rc,