Skip to content
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

Error message when removing only child from GraphNode #89695

Closed
JaythFactor opened this issue Mar 19, 2024 · 1 comment · Fixed by #90229
Closed

Error message when removing only child from GraphNode #89695

JaythFactor opened this issue Mar 19, 2024 · 1 comment · Fixed by #90229

Comments

@JaythFactor
Copy link

JaythFactor commented Mar 19, 2024

Tested versions

Reproducible in 4.3.dev5, 4.2.1 stable
Not Reproducible in 4.1.1 and 4.0.2

System information

Windows 10

Issue description

Whenever I try removing a child from a GraphNode when the removing child is the only child, an error message is issued in the output:
Screenshot 2024-03-19 175626

scene/main/node.cpp:1614 - Index p_index = 0 is out of bounds ((int)data.children_cache.size() - data.internal_children_front_count_cache - data.internal_children_back_count_cache = 0).

I would expect this error not to appear when removing the only child.

This issue had been encountered and fixed before when it caused the editor to crash: #69284

Since then, it appears to have returned, but it fortunately does not crash the editor.

Steps to reproduce

  1. Create a new GraphNode.
  2. Add a child node to the GraphNode.
  3. Delete the child node created in step 2.
  4. Observe the error in the Output.

Minimal reproduction project (MRP)

min_repro_project.zip

@Santoss1809
Copy link
Contributor

Hi, I'm a student and i managed to solve this issue by changing this check to (>1), because before it didnt take into account the HboxContainer Node. Will open a PR soon.
image

PrometheosFire added a commit to PrometheosFire/godot that referenced this issue Apr 3, 2024
…aphNode

A previous commit added an internal node (HboxContainer) to the
GraphNode, so get_child_count() > 0 would always be true.
When deleting the last child, there would be an error message because
of this behavior.
The fix was to make get_child_count only count non-internal nodes in
function _notification.
Made a unit test describing the behavior expected of
deleting the last child from a GraphNode.
@akien-mga akien-mga added this to the 4.3 milestone Apr 20, 2024
theromis pushed a commit to theromis/godot that referenced this issue Apr 29, 2024
dimitry- pushed a commit to AndroidWasm/godot that referenced this issue May 16, 2024
MewPurPur pushed a commit to MewPurPur/godot that referenced this issue Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants