Repository: godotengine/godot (language: cpp)

Issue:
Animation Tree Editor Crashes.
### Tested versions

Reproducible in every commit after https://github.com/godotengine/godot/commit/96a6dc289f823602b9a6e8450a9b68b3e15be757


### System information

Godot v4.4.beta unknown - Windows 11 (build 22631) - Multi-window, 1 monitor - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 4080 Laptop GPU (NVIDIA; 32.0.15.6636) - Intel(R) Core(TM) i9-14900HX (32 threads)

### Issue description

after following commit Animation Tree works fine in game but switching to the Animation Tree Editor in the bottom panel crashes the editor.
https://github.com/godotengine/godot/commit/96a6dc289f823602b9a6e8450a9b68b3e15be757

![Image](https://github.com/user-attachments/assets/2394a7db-4b9d-4392-8952-e5f0fc7f1011)

### Steps to reproduce

Have a complex animation system. Open Animation Tree Editor

### Minimal reproduction project (MRP)

N/A


Discussion / hints:
CC @Nazarwadim 
Please upload an MRP to help test this, as it requires a bit more specific conditions
> Please upload an MRP to help test this, as it requires a bit more specific conditions

Working on it but as I mentioned on the commit It's a quite complex anim tree. I am not sure if its something specific in the anim tree i was working on or maybe caused by opening an anim tree crated in the old version.
That would be critical information to test this so if you're able to figure that out it would help a lot!
Since you're compiling from source, can you confirm that reverting https://github.com/godotengine/godot/commit/96a6dc289f823602b9a6e8450a9b68b3e15be757 locally on top of the latest `master` branch solves the issue?

This was an optimization so if we're not able to identify quickly what causes it to crash, it's probably best to revert for now, and revisit this for 4.5 with more testing. But eventually we'd need to understand why it causes a crash anyway if we want to merge it again.
> Since you're compiling from source, can you confirm that reverting [96a6dc2](https://github.com/godotengine/godot/commit/96a6dc289f823602b9a6e8450a9b68b3e15be757) locally on top of the latest `master` branch solves the issue?
> 
> This was an optimization so if we're not able to identify quickly what causes it to crash, it's probably best to revert for now, and revisit this for 4.5 with more testing. But eventually we'd need to understand why it causes a crash anyway if we want to merge it again.

Just tested. Reverting changes solves the problem.
![Image](https://github.com/user-attachments/assets/00a730c6-a3fd-493a-bdc8-5c3d6f67ba97)

Fix patch:
diff --git a/scene/animation/animation_blend_tree.h b/scene/animation/animation_blend_tree.h
index 1b3d7f236e39..36a391ebdbde 100644
--- a/scene/animation/animation_blend_tree.h
+++ b/scene/animation/animation_blend_tree.h
@@ -410,7 +410,7 @@ class AnimationNodeBlendTree : public AnimationRootNode {
 		Vector<StringName> connections;
 	};
 
-	AHashMap<StringName, Node> nodes;
+	RBMap<StringName, Node, StringName::AlphCompare> nodes;
 
 	Vector2 graph_offset;
 
diff --git a/scene/animation/animation_tree.h b/scene/animation/animation_tree.h
index d5b1d4ea460b..5ac24b498577 100644
--- a/scene/animation/animation_tree.h
+++ b/scene/animation/animation_tree.h
@@ -306,8 +306,8 @@ class AnimationTree : public AnimationMixer {
 		uint64_t last_pass = 0;
 		real_t activity = 0.0;
 	};
-	mutable AHashMap<StringName, LocalVector<Activity>> input_activity_map;
-	mutable AHashMap<StringName, LocalVector<Activity> *> input_activity_map_get;
+	mutable HashMap<StringName, LocalVector<Activity>> input_activity_map;
+	mutable HashMap<StringName, LocalVector<Activity> *> input_activity_map_get;
 
 	NodePath animation_player;
 


Test patch: