Use BinaryMutex instead of Mutex for StringName.

This commit is contained in:
Lukas Tenbrink
2025-04-09 14:53:16 +02:00
parent 67c96c89cc
commit e57427900f
4 changed files with 15 additions and 12 deletions

View File

@ -2226,6 +2226,16 @@ void Object::detach_from_objectdb() {
}
}
void Object::assign_class_name_static(const Span<char> &p_name, StringName &r_target) {
static BinaryMutex _mutex;
MutexLock lock(_mutex);
if (r_target) {
// Already assigned while we were waiting for the mutex.
return;
}
r_target = StringName(p_name.ptr(), true);
}
Object::~Object() {
if (script_instance) {
memdelete(script_instance);