Skip to content

Commit 00beda9

Browse files
committed
Fix: Removed freed up FontData's dangling data in Advanced and Fallback text server
1 parent 6c9765d commit 00beda9

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

modules/text_server_adv/text_server_adv.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,12 @@ void TextServerAdvanced::_free_rid(const RID &p_rid) {
397397
MutexLock ftlock(ft_mutex);
398398

399399
FontAdvanced *fd = font_owner.get_or_null(p_rid);
400+
for (const KeyValue<Vector2i, FontForSizeAdvanced *> &ffsd : fd->cache) {
401+
OversamplingLevel *ol = oversampling_levels.getptr(ffsd.value->viewport_oversampling);
402+
if (ol != nullptr) {
403+
ol->fonts.erase(ffsd.value);
404+
}
405+
}
400406
{
401407
MutexLock lock(fd->mutex);
402408
font_owner.free(p_rid);

modules/text_server_fb/text_server_fb.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,12 @@ void TextServerFallback::_free_rid(const RID &p_rid) {
121121
MutexLock ftlock(ft_mutex);
122122

123123
FontFallback *fd = font_owner.get_or_null(p_rid);
124+
for (const KeyValue<Vector2i, FontForSizeFallback *> &ffsd : fd->cache) {
125+
OversamplingLevel *ol = oversampling_levels.getptr(ffsd.value->viewport_oversampling);
126+
if (ol != nullptr) {
127+
ol->fonts.erase(ffsd.value);
128+
}
129+
}
124130
{
125131
MutexLock lock(fd->mutex);
126132
font_owner.free(p_rid);

0 commit comments

Comments
 (0)