mirror of
https://github.com/godotengine/godot.git
synced 2024-11-25 05:33:11 +00:00
Merge pull request #70850 from bruvzg/ts_tsafe_free
[TextServer] Make `free` calls thread safe.
This commit is contained in:
commit
96f12040c9
@ -385,11 +385,17 @@ void TextServerAdvanced::_free_rid(const RID &p_rid) {
|
||||
_THREAD_SAFE_METHOD_
|
||||
if (font_owner.owns(p_rid)) {
|
||||
FontAdvanced *fd = font_owner.get_or_null(p_rid);
|
||||
{
|
||||
MutexLock lock(fd->mutex);
|
||||
font_owner.free(p_rid);
|
||||
}
|
||||
memdelete(fd);
|
||||
} else if (shaped_owner.owns(p_rid)) {
|
||||
ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_rid);
|
||||
{
|
||||
MutexLock lock(sd->mutex);
|
||||
shaped_owner.free(p_rid);
|
||||
}
|
||||
memdelete(sd);
|
||||
}
|
||||
}
|
||||
|
@ -115,11 +115,17 @@ void TextServerFallback::_free_rid(const RID &p_rid) {
|
||||
_THREAD_SAFE_METHOD_
|
||||
if (font_owner.owns(p_rid)) {
|
||||
FontFallback *fd = font_owner.get_or_null(p_rid);
|
||||
{
|
||||
MutexLock lock(fd->mutex);
|
||||
font_owner.free(p_rid);
|
||||
}
|
||||
memdelete(fd);
|
||||
} else if (shaped_owner.owns(p_rid)) {
|
||||
ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_rid);
|
||||
{
|
||||
MutexLock lock(sd->mutex);
|
||||
shaped_owner.free(p_rid);
|
||||
}
|
||||
memdelete(sd);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user