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

GDScript debugger may get null object issue #74297

Closed
hakuhan opened this issue Mar 3, 2023 · 20 comments
Closed

GDScript debugger may get null object issue #74297

hakuhan opened this issue Mar 3, 2023 · 20 comments

Comments

@hakuhan
Copy link
Contributor

hakuhan commented Mar 3, 2023

Godot version

4.0 stable

System information

Windows11

Issue description

null check always false

Steps to reproduce

image

Minimal reproduction project

no need

@AThousandShips
Copy link
Member

But the children of a node are never null?

@AThousandShips
Copy link
Member

Are you certain this node is null? There are some cases when the debugger shows data as null when they are too large

@hakuhan
Copy link
Contributor Author

hakuhan commented Mar 3, 2023

But the children of a node are never null?

Do you mean it is just a debug issue?

@AThousandShips
Copy link
Member

I'm not sure but it looks very strange that a child of a node is null, that should never happen as far as I know

@hakuhan
Copy link
Contributor Author

hakuhan commented Mar 3, 2023

I agree with you. I store this child to a list for later use. And I got a null value. So I foud this issue.

@AThousandShips
Copy link
Member

Is the node still valid at that time? Has it got deleted?

@hakuhan
Copy link
Contributor Author

hakuhan commented Mar 3, 2023

Real value isn't null.
image
image

@AThousandShips
Copy link
Member

#74148 might solve this

@hakuhan
Copy link
Contributor Author

hakuhan commented Mar 3, 2023

Is the node still valid at that time? Has it got deleted?

Many child nodes in my list are null. But not 100% make it clear.

@AThousandShips
Copy link
Member

Oh, sorry I was confused, can you confirm that the nodes are null, and how do you do so?

@dalexeev
Copy link
Member

dalexeev commented Mar 3, 2023

Are you sure it's null and not Freed Object?

var node := Node.new()
print(node) # <Node#3501556037163>
print(node == null) # false
print(node != null) # true
print("+" if node else "-") # +
print("+" if not node else "-") # -

node.free()
print(node) # <Freed Object>
print(node == null) # true
print(node != null) # false
print("+" if node else "-") # +
print("+" if not node else "-") # +

node = null
print(node) # <null>
print(node == null) # true
print(node != null) # false
print("+" if node else "-") # -
print("+" if not node else "-") # +

See also #59816.

@hakuhan
Copy link
Contributor Author

hakuhan commented Mar 3, 2023

I check children at _ready function, It should not be null
image

@hakuhan
Copy link
Contributor Author

hakuhan commented Mar 3, 2023

But from logs. These children are not null. And I think there has another issues. Because my dictionary container is null when I trying to got one child and I'm sure that container was initailized.
Sorry. Not true

@hakuhan
Copy link
Contributor Author

hakuhan commented Mar 3, 2023

Are you sure it's null and not Freed Object?

var node := Node.new()
print(node) # <Node#3501556037163>
print(node == null) # false
print(node != null) # true
print("+" if node else "-") # +
print("+" if not node else "-") # -

node.free()
print(node) # <Freed Object>
print(node == null) # true
print(node != null) # false
print("+" if node else "-") # +
print("+" if not node else "-") # +

node = null
print(node) # <null>
print(node == null) # true
print(node != null) # false
print("+" if node else "-") # -
print("+" if not node else "-") # +

See also #59816.

My codes work at beta12. I upgrade engine from beta12 to stable. This issue #59816 comes from alpha version.

@dalexeev
Copy link
Member

dalexeev commented Mar 3, 2023

Have you checked that the node is null? The tooltip can lie:

Are you certain this node is null? There are some cases when the debugger shows data as null when they are too large

@hakuhan
Copy link
Contributor Author

hakuhan commented Mar 3, 2023

Have you checked that the node is null? The tooltip can lie:

Are you certain this node is null? There are some cases when the debugger shows data as null when they are too large

It's not null. I think it is a debugger issue. I will add more comments when I have a conclusion.

@hakuhan
Copy link
Contributor Author

hakuhan commented Mar 3, 2023

It is a debugger issue. Equations(==, !=) are right!

@hakuhan hakuhan changed the title GDScript cannot check Object == null GDScript debugger may get null object issue Mar 3, 2023
@adamscott
Copy link
Member

adamscott commented Mar 4, 2023

Minimal reproduction project

no need

Citing CONTRIBUTING.md:

To speed up our work, please upload a minimal project that isolates and reproduces the issue. This is always the best way for us to fix it. We recommend attaching a ZIP file with the minimal project directly to the bug report, by drag and dropping the file in the GitHub edition field. This ensures the file can remain available for a long period of time. Only use third-party file hosts if your ZIP file isn't accepted by GitHub because it's too large.

We recommend always attaching a minimal reproduction project, even if the issue may seem simple to reproduce manually.

Please join a MRP. This will especially help to know if your issue is resolved or not by a PR.

@hakuhan
Copy link
Contributor Author

hakuhan commented Mar 5, 2023

Minimal reproduction project

no need

Citing CONTRIBUTING.md:

To speed up our work, please upload a minimal project that isolates and reproduces the issue. This is always the best way for us to fix it. We recommend attaching a ZIP file with the minimal project directly to the bug report, by drag and dropping the file in the GitHub edition field. This ensures the file can remain available for a long period of time. Only use third-party file hosts if your ZIP file isn't accepted by GitHub because it's too large.
We recommend always attaching a minimal reproduction project, even if the issue may seem simple to reproduce manually.

Please join a MRP. This will especially help to know if your issue is resolved or not by a PR.

OK

@Calinou Calinou closed this as not planned Won't fix, can't repro, duplicate, stale Mar 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants