Merge pull request #106833 from avnotaklu/window-scaling-breaking-on-font-data-freed

Remove freed up FontForSize data from `oversampling_levels`
This commit is contained in:
Thaddeus Crews 2025-05-28 09:47:40 -05:00
commit 698dd2ade4
No known key found for this signature in database
GPG key ID: 8C6E5FEB5FC03CCC
2 changed files with 12 additions and 0 deletions

View file

@ -397,6 +397,12 @@ void TextServerAdvanced::_free_rid(const RID &p_rid) {
MutexLock ftlock(ft_mutex);
FontAdvanced *fd = font_owner.get_or_null(p_rid);
for (const KeyValue<Vector2i, FontForSizeAdvanced *> &ffsd : fd->cache) {
OversamplingLevel *ol = oversampling_levels.getptr(ffsd.value->viewport_oversampling);
if (ol != nullptr) {
ol->fonts.erase(ffsd.value);
}
}
{
MutexLock lock(fd->mutex);
font_owner.free(p_rid);

View file

@ -121,6 +121,12 @@ void TextServerFallback::_free_rid(const RID &p_rid) {
MutexLock ftlock(ft_mutex);
FontFallback *fd = font_owner.get_or_null(p_rid);
for (const KeyValue<Vector2i, FontForSizeFallback *> &ffsd : fd->cache) {
OversamplingLevel *ol = oversampling_levels.getptr(ffsd.value->viewport_oversampling);
if (ol != nullptr) {
ol->fonts.erase(ffsd.value);
}
}
{
MutexLock lock(fd->mutex);
font_owner.free(p_rid);