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 (Engine Bug) when using yield completed #31455

Closed
muchitto opened this issue Aug 18, 2019 · 2 comments · Fixed by #31737
Closed

Stack Underflow (Engine Bug) when using yield completed #31455

muchitto opened this issue Aug 18, 2019 · 2 comments · Fixed by #31737
Assignees
Milestone

Comments

@muchitto
Copy link

muchitto commented Aug 18, 2019

Godot version:
3.2-dev (fb5e8b5)

OS/device including version:
Windows 10 x64

Issue description:
I was implementing a kind of state machine and ran into the Stack Underflow (Engine Bug) problem, which has been mentioned in issue #30269. It seems to occur at specific times when using the yield(gdfunctionstate, "completed") kind of code.

Steps to reproduce:
Open the project, run and press space (or any of the default "ui_accept" action keys).
All the code in the minimal reproduction project is in the Main.gd file:

extends Node2D

class Runner:
	signal ContinueExecution()
	
	func continue_excution ():
		emit_signal("ContinueExecution")
	
	func run_data ():
		var run_state = run_branch()
		
		if run_state is GDScriptFunctionState:
			yield(run_state, "completed")
			
		return run_state
	
	func run_branch ():
		yield(self, "ContinueExecution")
	
var data_intpr := Runner.new()

func _ready():
	data_intpr.run_data()

func _process(delta):
	if Input.is_action_just_pressed("ui_accept"):
		data_intpr.continue_excution()

Minimal reproduction project:
Stack Underflow Yield problem.zip

@muchitto
Copy link
Author

muchitto commented Aug 18, 2019

Ok, if you comment out the return line from the run_data() function, it doesn't show the underflow error...

@bojidar-bg
Copy link
Contributor

Probably related to this comment on the PR which change yield: https://github.com/godotengine/godot/pull/28884/files/9df1a2442b480f9ed8a8d4ec8992ea5046b98719#r284189443

bojidar-bg added a commit to bojidar-bg/godot that referenced this issue Aug 28, 2019
@akien-mga akien-mga added this to the 3.2 milestone Aug 28, 2019
pchasco pushed a commit to pchasco/godot that referenced this issue Oct 23, 2019
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