From f2b4d9aaa143a39f4bacf3b417f67ae6d5b31b40 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Sat, 4 Jan 2025 07:08:19 -0800
Subject: [PATCH] Fixed crash freeing text after the engine has been freed
Fixes https://github.com/libsdl-org/SDL_ttf/issues/459
---
examples/showfont.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/examples/showfont.c b/examples/showfont.c
index d3c62898..917b5210 100644
--- a/examples/showfont.c
+++ b/examples/showfont.c
@@ -605,6 +605,7 @@ int main(int argc, char *argv[])
}
SDL_DestroySurface(text);
EditBox_Destroy(scene.edit);
+ TTF_DestroyText(scene.caption);
TTF_CloseFont(font);
switch (scene.textEngine) {
case TextEngineSurface:
@@ -616,7 +617,6 @@ int main(int argc, char *argv[])
default:
break;
}
- TTF_DestroyText(scene.caption);
SDL_DestroyTexture(scene.message);
Cleanup(0);