Use BinaryMutex instead of Mutex for StringName.
This commit is contained in:
@ -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);
|
||||
|
||||
Reference in New Issue
Block a user