limbonaut / limboai

LimboAI - Behavior Trees and State Machines for Godot 4

Home Page:https://limboai.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Crash when freeing agent with performance monitoring enabled

jjennings955 opened this issue · comments

I had an issue when I freed my agent with a BTPlayer with monitor_performance = true, it would crash the game completely with no error message.

I attached a minimal example. If you run main.tscn and click "spawn agent" and then "free agent bad", it should crash immediately with no error message (or it might take a few tries). If you spawn an agent and then click "free agent good" it doesn't crash.

minimal example: godot_crash.zip

This is with the version from the asset store (included) and Godot 4.2.2 (15073afe3)

I also copied some of this logic (below) from the demo code and it still crashed, but I didn't include any of that in this minimal example.

func die() -> void:
	if _is_dead:
		return
	death.emit()
	_is_dead = true
	root.process_mode = Node.PROCESS_MODE_DISABLED
	animation_player.play(&"death")
	collision_shape_2d.set_deferred(&"disabled", true)

	for child in get_children():
		if child is BTPlayer or child is LimboHSM:
			child.set_active(false)

	if get_tree():
		await get_tree().create_timer(10.0).timeout
		print("freeing")
		queue_free()

Thanks for reporting! I made a PR to fix it. Should come with v1.1.0 release in a few weeks.
You can also use this build in the meantime: https://github.com/limbonaut/limboai/actions/runs/9364549957