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

C++ error on storing viewport node in variable #64348

Closed
Lalafella opened this issue Aug 13, 2022 · 2 comments
Closed

C++ error on storing viewport node in variable #64348

Lalafella opened this issue Aug 13, 2022 · 2 comments

Comments

@Lalafella
Copy link

Lalafella commented Aug 13, 2022

Godot version

3.5.stable

System information

Window 10

Issue description

When I store viewport node in a variable to use it later, it gave me a lot of [getornull: Condition "!id_map.has(p_rid.get_data())" is true. Returned: __null] which flooded my debugger stack. It is not gamebreaking but sure is pretty annoying one.

The fix is to do not store viewport node in variable and using get_node to call its function instead but it is not entirely fixed and can still happen sometimes.

Steps to reproduce

I ran this code in my SceneChanger which is in autoload.

func _ready():
yield(get_tree() , "idle_frame")

if get_tree().get_current_scene().has_node("map_viewport_container/map_viewport"):
	map_viewport = get_tree().get_current_scene().get_node("map_viewport_container/map_viewport")

if map_viewport and map_viewport.get_children().size() > 0 :
	for map in map_viewport.get_children():
		if map.is_in_group("Map_Scene"):
			current_map_scene = map
			break
battle_scene_container = get_tree().get_current_scene().get_node("battle_scene_container")

I remove map_viewport variable and replace them with get_tree().get_current_scene().get_node("map_viewport_container/map_viewport") instead and it is fixed but I still get the problem again sometimes.

Minimal reproduction project

No response

@Calinou
Copy link
Member

Calinou commented Aug 13, 2022

This is likely a dangling reference: #41360

Please upload a minimal reproduction project to make this easier to troubleshoot.

@AThousandShips
Copy link
Member

Closing due to lack of response, if you provide the requested information this can be reopened

@AThousandShips AThousandShips closed this as not planned Won't fix, can't repro, duplicate, stale Jul 29, 2024
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

3 participants