1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-08 12:40:44 +00:00

Defer updating the animations Tree in SpriteFramesEditor to avoid crashes

Previously, clicking the LMB while renaming an animation could cause
`SpriteFramesEditor::_update_library(false)` to be called during
`Tree::propagate_mouse_event()`. This may cause a crash.

We can defer updates to the editor interface to avoid calling
`Tree::create_item()` at the wrong time.

Enables `SpriteFramesEditor::_select_animation()` to be able to undo/redo
This commit is contained in:
风青山
2023-09-14 18:06:49 +08:00
parent fd33c7b32f
commit 2642c6851f
2 changed files with 31 additions and 11 deletions

View File

@@ -189,6 +189,7 @@ class SpriteFramesEditor : public HSplitContainer {
void _down_pressed();
void _frame_duration_changed(double p_value);
void _update_library(bool p_skip_selector = false);
void _update_library_impl();
void _update_stop_icon();
void _play_pressed();
@@ -214,6 +215,9 @@ class SpriteFramesEditor : public HSplitContainer {
void _zoom_out();
void _zoom_reset();
bool animations_dirty = false;
bool pending_update = false;
bool updating;
bool updating_split_settings = false; // Skip SpinBox/Range callback when setting value by code.