Merge pull request #100363 from RandomShaper/fix_mtl_mt_deadlock_4.4

Fix deadlock possibility in threaded load of materials
This commit is contained in:
Thaddeus Crews 2024-12-13 16:19:24 -06:00
commit 5527bcbfbe
No known key found for this signature in database
GPG Key ID: 62181B86FE9E5D84
3 changed files with 15 additions and 3 deletions

View File

@ -157,9 +157,13 @@ void CanvasItemMaterial::flush_changes() {
}
void CanvasItemMaterial::_queue_shader_change() {
if (!_is_initialized()) {
return;
}
MutexLock lock(material_mutex);
if (_is_initialized() && !element.in_list()) {
if (!element.in_list()) {
dirty_materials.add(&element);
}
}

View File

@ -1970,9 +1970,13 @@ void BaseMaterial3D::flush_changes() {
}
void BaseMaterial3D::_queue_shader_change() {
if (!_is_initialized()) {
return;
}
MutexLock lock(material_mutex);
if (_is_initialized() && !element.in_list()) {
if (!element.in_list()) {
dirty_materials.add(&element);
}
}

View File

@ -1172,9 +1172,13 @@ void ParticleProcessMaterial::flush_changes() {
}
void ParticleProcessMaterial::_queue_shader_change() {
if (!_is_initialized()) {
return;
}
MutexLock lock(material_mutex);
if (_is_initialized() && !element.in_list()) {
if (!element.in_list()) {
dirty_materials.add(&element);
}
}