-
-
Notifications
You must be signed in to change notification settings - Fork 574
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Godot crashes when using cast_to
on a node that precedes GDNative node in tree
#860
Comments
Okay, I really wish this was documented somewhere, but it turns out that the result of Besides, I thought calling |
It isn't a rule that the result of Side note, might not be related to the crash: Godot::print(Object::cast_to<Node>(actions[0])->get("name").operator String()); A lot of things can go wrong in this line. If ERR_FAIL_COND(actions.size() == 0)
Node *node = Object::cast_to<Node>(actions[0]);
ERR_FAIL_COND(node == nullptr);
Godot::print(node->get_name()); // Also changed this one because a function exists for this |
@MGilleronFJ thanks for the info! I don't think the issue is with actions being empty or node being null, since I can see the node's name printed. Update: I can see my code crashing even when doing just this:
Replacing |
Seems like godotengine/godot#48295 might be related to this. |
First of all, sorry for no stack trace: this is reproducible only with
release
builds for some reason...Here's my code:
Here's the tree:
Within
agent
, I have the following code:The above code succeeds and prints
empty_node
. However, when I unload the scene to load another (by usingparent.queue_free()
), the game segfaults.If I move
empty_node
AFTERgoapplanner
, the crash does not happen.This is strange since I don't even keep the reference to
Node*
anywhere, I just castactions[0]
toNode*
and then throw it away. Docast_to
-ed objects have to be marked/freed somehow?Any ideas about what's going on here?
The text was updated successfully, but these errors were encountered: