You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using an AnimationPlayer with an AnimatedSprite2D, setting the animation property of the AnimatedSprite2D to one animation then setting it to another animation in the AnimationPlayer will crash the editor. This bug is reproducible 100% of the time on 4.2beta2, 4.2beta3, 4.2beta4 and the master branch. But I could not reproduce it on 4.1.2-stable and on 4.2beta1. So it's likely a regression issue starting on 4.2beta2.
The crash is silent on the editor using any of the release builds above, doesn't give the user any error messages even when running from console. But debugging in development mode from master in Visual Studio would exit with a Read access violation pointing at line 100 of hash_map.h. Which is this line:
bool _lookup_pos(const TKey &p_key, uint32_t &r_pos) const {
if (elements == nullptr || num_elements == 0) { // <-- Read Access Violation here
return false; // Failed lookups, no elements
}
Here's a screenshot of the exception in Visual Studio:
The full stack trace:
godot.windows.editor.dev.x86_64.exe!HashMap<StringName,SpriteFrames::Anim,HashMapHasherDefault,HashMapComparatorDefault<StringName>,DefaultTypedAllocator<HashMapElement<StringName,SpriteFrames::Anim>>>::_lookup_pos(const StringName & p_key, unsigned int & r_pos) Line 100 C++
godot.windows.editor.dev.x86_64.exe!HashMap<StringName,SpriteFrames::Anim,HashMapHasherDefault,HashMapComparatorDefault<StringName>,DefaultTypedAllocator<HashMapElement<StringName,SpriteFrames::Anim>>>::has(const StringName & p_key) Line 312 C++
godot.windows.editor.dev.x86_64.exe!SpriteFrames::has_animation(const StringName & p_anim) Line 107 C++
godot.windows.editor.dev.x86_64.exe!SpriteFramesEditor::_select_animation(const String & p_name, bool p_update_node) Line 873 C++
godot.windows.editor.dev.x86_64.exe!SpriteFramesEditor::_sync_animation() Line 868 C++
godot.windows.editor.dev.x86_64.exe!call_with_variant_args_helper<SpriteFramesEditor>(SpriteFramesEditor * p_instance, void(SpriteFramesEditor::*)() p_method, const Variant * * p_args, Callable::CallError & r_error, IndexSequence<> __formal) Line 308 C++
godot.windows.editor.dev.x86_64.exe!call_with_variant_args<SpriteFramesEditor>(SpriteFramesEditor * p_instance, void(SpriteFramesEditor::*)() p_method, const Variant * * p_args, int p_argcount, Callable::CallError & r_error) Line 418 C++
godot.windows.editor.dev.x86_64.exe!CallableCustomMethodPointer<SpriteFramesEditor>::call(const Variant * * p_arguments, int p_argcount, Variant & r_return_value, Callable::CallError & r_call_error) Line 105 C++
godot.windows.editor.dev.x86_64.exe!Callable::callp(const Variant * * p_arguments, int p_argcount, Variant & r_return_value, Callable::CallError & r_call_error) Line 58 C++
godot.windows.editor.dev.x86_64.exe!CallQueue::_call_function(const Callable & p_callable, const Variant * p_args, int p_argcount, bool p_show_error) Line 220 C++
godot.windows.editor.dev.x86_64.exe!CallQueue::flush() Line 326 C++
godot.windows.editor.dev.x86_64.exe!SceneTree::physics_process(double p_time) Line 473 C++
godot.windows.editor.dev.x86_64.exe!Main::iteration() Line 3575 C++
godot.windows.editor.dev.x86_64.exe!OS_Windows::run() Line 1474 C++
godot.windows.editor.dev.x86_64.exe!widechar_main(int argc, wchar_t * * argv) Line 182 C++
godot.windows.editor.dev.x86_64.exe!_main() Line 204 C++
godot.windows.editor.dev.x86_64.exe!main(int argc, char * * argv) Line 218 C++
godot.windows.editor.dev.x86_64.exe!WinMain(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, char * lpCmdLine, int nCmdShow) Line 232 C++
[External Code]
Steps to reproduce
Open Minimal Reproduction Project using Godot 4.2beta4
Open player.tscn
Click the AnimatedSprite2D (note how the selected animation is 'anim2')
Click the AnimationPlayer (its current_animation should be at 'RESET')
Change the current_animation to 'anim1' (which will try to set the animation of the AnimatedSprite2D to 'anim1')
Editor crashes
This is one sure way to crash, but it's only one. Any other way of setting the animation property with the AnimationPlayer to a different one to what's selected in the AnimatedSprite2D will cause a crash. You could, for example, first change the current_animation on the AnimationPlayer to 'anim2' then click on the AnimatedSprite2D and change the selected animation to 'anim1', then try to save the scene. That will also crash. Note how I disabled the track that sets the animation on the 'RESET' animation to 'anim1'. If you reenable that, then simply clicking on the AnimatedSprite2D then clicking back on the AnimationPlayer will also crash. As long as the AnimatedSprite2D has one animation selected and the AnimationPlayer tries to change it to another, the editor will crash.
In previous versions (4.2beta1) when the 2 diverged, the AnimationPlayer node would just change the value of the animation in the AnimatedSprite2D node to whatever was in the AnimationPlayer tracks instead of crashing the editor.
It is reproducible on a fresh project. The uploaded Minimal Reproduction Project is a fresh project where I just added one scene with an AnimatedSprite2D and an AnimationPlayer to demonstrate the bug.
The reason why deleting the .godot folder can help is because the crash happens when the Animation Player tries to change the currently selected animation in the AnimatedSprite2D. Closing an opened scene will unselect any animation from memory so that allows you to click the Animation Player and select any animation without crashing. And deleting the .godot folder is the same as closing all scenes.
That's why on the reproduction steps above step 3 is to click the AnimatedSprite2D first to load it into memory. Without that step, clicking in the Animation Player directly, will not crash.
Godot version
4.2beta4 and master
System information
Godot v4.2.beta4 - Windows 10.0.22621 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 4050 Laptop GPU (NVIDIA; 31.0.15.4601) - 13th Gen Intel(R) Core(TM) i7-13650HX (20 Threads)
Issue description
When using an
AnimationPlayer
with anAnimatedSprite2D
, setting theanimation
property of theAnimatedSprite2D
to one animation then setting it to another animation in theAnimationPlayer
will crash the editor. This bug is reproducible 100% of the time on 4.2beta2, 4.2beta3, 4.2beta4 and the master branch. But I could not reproduce it on 4.1.2-stable and on 4.2beta1. So it's likely a regression issue starting on 4.2beta2.The crash is silent on the editor using any of the release builds above, doesn't give the user any error messages even when running from console. But debugging in development mode from master in Visual Studio would exit with a
Read access violation
pointing at line 100 ofhash_map.h
. Which is this line:Here's a screenshot of the exception in Visual Studio:
The full stack trace:
Steps to reproduce
animation
is 'anim2')current_animation
should be at 'RESET')current_animation
to 'anim1' (which will try to set theanimation
of the AnimatedSprite2D to 'anim1')This is one sure way to crash, but it's only one. Any other way of setting the
animation
property with the AnimationPlayer to a different one to what's selected in the AnimatedSprite2D will cause a crash. You could, for example, first change thecurrent_animation
on the AnimationPlayer to 'anim2' then click on the AnimatedSprite2D and change the selectedanimation
to 'anim1', then try to save the scene. That will also crash. Note how I disabled the track that sets theanimation
on the 'RESET' animation to 'anim1'. If you reenable that, then simply clicking on the AnimatedSprite2D then clicking back on the AnimationPlayer will also crash. As long as the AnimatedSprite2D has oneanimation
selected and the AnimationPlayer tries to change it to another, the editor will crash.In previous versions (4.2beta1) when the 2 diverged, the AnimationPlayer node would just change the value of the
animation
in the AnimatedSprite2D node to whatever was in the AnimationPlayer tracks instead of crashing the editor.Minimal reproduction project
bug-apcrash.zip
or
https://github.com/vibrunazo/godot-bug-apcrash
The text was updated successfully, but these errors were encountered: