godot icon indicating copy to clipboard operation
godot copied to clipboard

GDScript debugger may get null object issue

Open hakuhan opened this issue 2 years ago • 19 comments

Godot version

4.0 stable

System information

Windows11

Issue description

null check always false

Steps to reproduce

image

Minimal reproduction project

no need

hakuhan avatar Mar 03 '23 13:03 hakuhan

But the children of a node are never null?

AThousandShips avatar Mar 03 '23 13:03 AThousandShips

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

AThousandShips avatar Mar 03 '23 13:03 AThousandShips

But the children of a node are never null?

Do you mean it is just a debug issue?

hakuhan avatar Mar 03 '23 13:03 hakuhan

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

AThousandShips avatar Mar 03 '23 13:03 AThousandShips

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.

hakuhan avatar Mar 03 '23 13:03 hakuhan

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

AThousandShips avatar Mar 03 '23 13:03 AThousandShips

Real value isn't null. image image

hakuhan avatar Mar 03 '23 13:03 hakuhan

#74148 might solve this

AThousandShips avatar Mar 03 '23 13:03 AThousandShips

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.

hakuhan avatar Mar 03 '23 13:03 hakuhan

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

AThousandShips avatar Mar 03 '23 13:03 AThousandShips

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.

dalexeev avatar Mar 03 '23 13:03 dalexeev

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

hakuhan avatar Mar 03 '23 13:03 hakuhan

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 avatar Mar 03 '23 13:03 hakuhan

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.

hakuhan avatar Mar 03 '23 13:03 hakuhan

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

dalexeev avatar Mar 03 '23 14:03 dalexeev

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 avatar Mar 03 '23 14:03 hakuhan

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

hakuhan avatar Mar 03 '23 14:03 hakuhan

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.

adamscott avatar Mar 04 '23 16:03 adamscott

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

hakuhan avatar Mar 05 '23 02:03 hakuhan

  • Duplicate of https://github.com/godotengine/godot/issues/36801.

Calinou avatar Mar 19 '23 03:03 Calinou