Description
Tested versions
Godot 4.5 beta1
System information
Windows 10
Issue description
RuntimeNodeSelect
crashes on multiple places because it does not handle cases where a collision objects is not attached to a Node or Object. Which is the case for basically all PhysicsServer API created objects as they require no node or object to function.
E.g.
RuntimeNodeSelect::_send_ids()
crashes on SceneDebuggerObject obj(node->get_instance_id());
RuntimeNodeSelect::_find_3d_items_at_rect()
crashes on an is_inside_tree() check.
In general assuming that any server RID object always has a Node or Object instance attached is faulty because all servers allow to work with server only created objects without any attached instance.
Steps to reproduce
Create a server physics object that does not has a Node instance id attached to it and try to click its position with the RuntimeNodeSelect.
extends Node3D
var space : RID
var body : RID
var shape : RID
func _ready():
space = get_world_3d().space
body = PhysicsServer3D.body_create()
shape = PhysicsServer3D.box_shape_create()
PhysicsServer3D.shape_set_data(shape, Vector3(100.0, 100.0, 100.0))
PhysicsServer3D.body_add_shape(body, shape)
PhysicsServer3D.body_set_space(body, space)
func _exit_tree():
PhysicsServer3D.free_rid(body)
PhysicsServer3D.free_rid(shape)
Minimal reproduction project (MRP)
See script examples, just drop it in a scene with a Camera3D and click somewhere to hit the server shape to make Godot crash.