From 930663d996eb55d441bcec525050a344525db0a3 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Tue, 28 Jan 2025 06:17:37 -0800
Subject: [PATCH] Clear the current number of positions when flushing the cache
Fixes https://github.com/libsdl-org/SDL_ttf/issues/479
---
src/SDL_ttf.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/SDL_ttf.c b/src/SDL_ttf.c
index d135c0d9..b48e25d9 100644
--- a/src/SDL_ttf.c
+++ b/src/SDL_ttf.c
@@ -2399,6 +2399,7 @@ static void Flush_Cache(TTF_Font *font)
if (cached->positions.pos) {
SDL_free(cached->positions.pos);
cached->positions.pos = NULL;
+ cached->positions.len = 0;
cached->positions.maxlen = 0;
}
}