You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue description:
When calling a GDScript method with a "previously freed instance" parameter, the error which is raised is not as clear as it could be. Maybe also for the "null instance" case, though I don't know how to reproduce it.
var node = Node.new()
node.free()
add_child(node)
raises:
Invalid type in function 'add_child' in base 'Node2D (Node2D.gd)'. The Object-derived class of argument 1 (previously freed instance) is not a subclass of the expected argument class.
if (p_err.error == Variant::CallError::CALL_ERROR_INVALID_ARGUMENT) {
int errorarg = p_err.argument;
// Handle the Object to Object case separately as we don't have further class details.
#ifdef DEBUG_ENABLED
if (p_err.expected == Variant::OBJECT && argptrs[errorarg]->get_type() == p_err.expected) {
err_text = "Invalid type in " + p_where + ". The Object-derived class of argument " + itos(errorarg + 1) + " (" + _get_var_type(argptrs[errorarg]) + ") is not a subclass of the expected argument class.";
} else
#endif// DEBUG_ENABLED
{
err_text = "Invalid type in " + p_where + ". Cannot convert argument " + itos(errorarg + 1) + " from " + Variant::get_type_name(argptrs[errorarg]->get_type()) + " to " + Variant::get_type_name(p_err.expected) + ".";
}
Steps to reproduce:
Use above snippet on any Node-derived script.
Minimal reproduction project:
See above.
The text was updated successfully, but these errors were encountered:
Well, there is the thing.. pre-existing references become "previously freed instance" instead of "null".
Note that things can get much worse from there on as of now:
varnode=Node.new()
node.free()
varnode2=Node.new()
add_child(node) # No error!print(node, node2) # e.g. [Node:1370][Node:1370]print(is_instance_valid(node)) # True ?!
But:
varnode=Node.new()
node.free()
varnode2=Sprite.new()
add_child(node) # Error: Same as before (if you are lucky with malloc)
Godot version:
3.2 master (3af0400)
OS/device including version:
Any
Issue description:
When calling a GDScript method with a "previously freed instance" parameter, the error which is raised is not as clear as it could be. Maybe also for the "null instance" case, though I don't know how to reproduce it.
raises:
Relevant code to adjust:
godot/modules/gdscript/gdscript_function.cpp
Lines 166 to 176 in 3af0400
Steps to reproduce:
Minimal reproduction project:
See above.
The text was updated successfully, but these errors were encountered: