Godot Version
4.2.1
Question
I add objects async and then call add child on the process thread. It looks like there are race conditions under which the item to add already got disposed. Is there a way to see if a Node3D is already disposed?
public ConcurrentQueue<Node3D> NodesToAdd { get; set; } = new ConcurrentQueue<Node3D>();
public override void _Process(double delta)
{
while (NodesToAdd.TryDequeue(out var node))
AddChild(node);
}
full info to help searches.
System.ObjectDisposedException
HResult=0x80131622
Message=Cannot access a disposed object.
Object name: ‘Godot.Node3D’.
Source=GodotSharp
StackTrace:
at Godot.GodotObject.GetPtr(GodotObject instance) in /root/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/GodotObject.base.cs:line 75