godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
88.9k stars 20.16k forks source link

Race condition in `Resource::connect_changed` #96115

Closed 0x0ACB closed 1 week ago

0x0ACB commented 2 weeks ago

Tested versions

4.3

System information

Windows 11

Issue description

62d9ce6445283d2bc1daa973350f91df56a826bf changed Resource::connect_changed to delay signal connection if the ResourceLoader is currently loading. This leads to issues if a ResourceLoader creates a PackedScene with eg a MeshInstance3D or CollisionShape3D on a thread other than the main thread.

<core\object\object.cpp(1369): Object::connect> Condition "!p_callable.is_valid()" is true. Returning: ERR_INVALID_PARAMETER:
Cannot connect to 'changed': the provided callable is not valid: MeshInstance3D::_mesh_changed

<core\object\object.cpp(1369): Object::connect> Condition "!p_callable.is_valid()" is true. Returning: ERR_INVALID_PARAMETER:
Cannot connect to 'changed': the provided callable is not valid: Node3D::update_gizmos

Steps to reproduce

Minimal reproduction project (MRP)

-

akien-mga commented 2 weeks ago

Tested versions

4.3

Please be more explicit, you mention 4.3 but then refer to a commit which has just been merged in master for 4.4, and thus isn't in 4.3.

0x0ACB commented 2 weeks ago

Uhm the commit has been added in 4.3 stable though. And I only downloaded the 4.3-stable tag:

image

akien-mga commented 2 weeks ago

Ah my bad, I mistook #94526 (which includes this commit and was merged for 4.3) for #94169 (which I just merged).

RandomShaper commented 2 weeks ago

An MRP would help immensely.

0x0ACB commented 2 weeks ago

This one triggers it quite reliably for me project.zip

RandomShaper commented 2 weeks ago

My assessment so far: