diff options
author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2023-01-02 21:59:05 +0200 |
---|---|---|
committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2023-01-02 21:59:05 +0200 |
commit | a28e8f0c8d3c792e05c0981888bd12117e52335a (patch) | |
tree | 44f63fe8d80a26a576b09e0f35797047417dde1c /modules/text_server_adv | |
parent | b29bb11a4cb5ffcca6ddcc4d495656f146bfd22a (diff) |
[TextServer] Make `free` calls thread safe.
Diffstat (limited to 'modules/text_server_adv')
-rw-r--r-- | modules/text_server_adv/text_server_adv.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/modules/text_server_adv/text_server_adv.cpp b/modules/text_server_adv/text_server_adv.cpp index f3e7ae9b83..1c744afec0 100644 --- a/modules/text_server_adv/text_server_adv.cpp +++ b/modules/text_server_adv/text_server_adv.cpp @@ -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); - font_owner.free(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); - shaped_owner.free(p_rid); + { + MutexLock lock(sd->mutex); + shaped_owner.free(p_rid); + } memdelete(sd); } } |