From e8485ee7e7b5487bad1e195235a93543c82b630a Mon Sep 17 00:00:00 2001 From: gingerBill Date: Sat, 14 May 2022 15:15:04 +0100 Subject: [PATCH] Correction to `image.destroy` --- core/image/common.odin | 2 +- core/image/general_loader.odin | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/core/image/common.odin b/core/image/common.odin index 28129a6e1..baacd64d9 100644 --- a/core/image/common.odin +++ b/core/image/common.odin @@ -57,7 +57,7 @@ Image :: struct { which: Which_File_Type, } -Image_Metadata :: union { +Image_Metadata :: union #shared_nil { ^Netpbm_Info, ^PNG_Info, ^QOI_Info, diff --git a/core/image/general_loader.odin b/core/image/general_loader.odin index 79f5fb737..bf0061311 100644 --- a/core/image/general_loader.odin +++ b/core/image/general_loader.odin @@ -52,7 +52,9 @@ destroy :: proc(img: ^Image, allocator := context.allocator) -> bool { destroyer := _internal_destroyers[img.which] if destroyer != nil { destroyer(img) + } else { + assert(img.metadata == nil) + free(img) } - free(img) return true } \ No newline at end of file