From 1cb85807dd3b92be837d7884d3fecbe84a5e8aba Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Mon, 9 Sep 2024 10:22:32 +0200 Subject: [PATCH] Fix mem leaks in the demo --- demo/demo/agents/fireball/fireball.gd | 2 ++ demo/demo/agents/ninja_star/ninja_star.gd | 2 ++ 2 files changed, 4 insertions(+) diff --git a/demo/demo/agents/fireball/fireball.gd b/demo/demo/agents/fireball/fireball.gd index a838bf0..9101514 100644 --- a/demo/demo/agents/fireball/fireball.gd +++ b/demo/demo/agents/fireball/fireball.gd @@ -41,6 +41,8 @@ func _physics_process(delta: float) -> void: func _die() -> void: + if _is_dead: + return _is_dead = true trail.emitting = false root.hide() diff --git a/demo/demo/agents/ninja_star/ninja_star.gd b/demo/demo/agents/ninja_star/ninja_star.gd index 6f8ac8c..7821796 100644 --- a/demo/demo/agents/ninja_star/ninja_star.gd +++ b/demo/demo/agents/ninja_star/ninja_star.gd @@ -39,6 +39,8 @@ func _physics_process(delta: float) -> void: func _die() -> void: + if _is_dead: + return _is_dead = true root.hide() collision_shape_2d.set_deferred(&"disabled", true)