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

Stack underflow on yielding #39011

Open
xoSauce opened this issue May 24, 2020 · 5 comments
Open

Stack underflow on yielding #39011

xoSauce opened this issue May 24, 2020 · 5 comments

Comments

@xoSauce
Copy link

xoSauce commented May 24, 2020

Godot version:
3.2.1
OS/device including version:
Windows 10
Issue description:
Stack underflow on yielding
Throws error:
E 0:00:12.232 _disconnect: Disconnecting nonexistent signal 'checkpoint_reached', slot: 1305:_signal_callback. <C++ Error> Condition "!s->slot_map.has(target)" is true. <C++ Source> core/object.cpp:1522 @ _disconnect()

I am unsure whether this error occurs because of the stack underflow or causes the stack underflow.

Steps to reproduce:
Running the following script attached to a node:

extends Spatial

export (Array) var checkpointPaths
export var moveSpeed := 100
onready var tween : Tween = $Tween
onready var rotate : Tween = $Rotate

signal checkpoint_reached
var moveToObjective = null

func _ready():
	print("Ready:", checkpointPaths)
	moveToObjective = move_to_objective()

func move_to_objective():
	var nav = get_node("../")
	for checkpointPath in checkpointPaths:
		var checkpointObject = get_node(checkpointPath)
		var navPoint = nav.get_closest_point(checkpointObject.translation)
		var path = Array(nav.get_simple_path(transform.origin, navPoint, true))
		follow_current_path(path)
		yield(self, "checkpoint_reached")
		print("Here")
		
func lookAtTarget(target):
	if (target != transform.origin):
		look_at(target, Vector3.UP)
		self.rotate_object_local(Vector3.UP, PI);
	
func follow_current_path(path) -> void:
	for p in path:
		p.y = 0
		print("Going to:", p)
		var duration = translation.distance_to(p) / (moveSpeed * get_physics_process_delta_time())
		lookAtTarget(p)
		tween.interpolate_property(self, 'translation', translation, p, duration, Tween.TRANS_LINEAR, Tween.EASE_IN)
		tween.start()
		yield(tween, "tween_completed")
	emit_signal("checkpoint_reached")

Minimal reproduction project:
3DTowerDefense.zip

@Calinou
Copy link
Member

Calinou commented May 24, 2020

(unsure how to attach it as I don't see any option to upload zip archive. I can upload to dropbox/google drive if required)

Drag and drop a ZIP archive smaller than 20 MB to the comment window while you're editing the comment.

@KoBeWi
Copy link
Member

KoBeWi commented May 24, 2020

(unsure how to attach it as I don't see any option to upload zip archive. I can upload to dropbox/google drive if required)
image

@Calinou
Copy link
Member

Calinou commented Jun 2, 2020

@xoSauce Bump 🙂 Could you upload a minimal reproduction project, please?

@xoSauce
Copy link
Author

xoSauce commented Jun 3, 2020

3DTowerDefense.zip

That should hopefully do it!
Apologies for the delay on this. The GitHub email got sent to spam (figures ...).

I notice the stack underflow when it turns towards the 2nd checkpoint.

@KoBeWi
Copy link
Member

KoBeWi commented Jun 6, 2020

I don't get the stack underflow error, but there are errors about nonexistent signal and instance gone, both invalid.

I wonder if it has something to do with yields inside for loops.

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