summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/text_server_adv/text_server_adv.cpp10
-rw-r--r--modules/text_server_fb/text_server_fb.cpp10
2 files changed, 16 insertions, 4 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);
}
}
diff --git a/modules/text_server_fb/text_server_fb.cpp b/modules/text_server_fb/text_server_fb.cpp
index ea7b7a271b..9fd8c8fb37 100644
--- a/modules/text_server_fb/text_server_fb.cpp
+++ b/modules/text_server_fb/text_server_fb.cpp
@@ -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);
- font_owner.free(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);
- shaped_owner.free(p_rid);
+ {
+ MutexLock lock(sd->mutex);
+ shaped_owner.free(p_rid);
+ }
memdelete(sd);
}
}