1
0
Fork 0

TileSet: Fix potential crash updating stale atlas source editor toolbar

This commit is contained in:
Rémi Verschelde 2025-05-25 14:06:57 +02:00
parent 45fc515ae3
commit d0f99ec3d3
No known key found for this signature in database
GPG Key ID: C3336907360768E1
2 changed files with 5 additions and 3 deletions

View File

@ -894,10 +894,9 @@ void TileSetAtlasSourceEditor::_update_current_tile_data_editor() {
// Get the correct editor for the TileData's property.
if (current_tile_data_editor) {
current_tile_data_editor_toolbar = current_tile_data_editor->get_toolbar();
current_property = property;
current_tile_data_editor->set_visible(tools_button_group->get_pressed_button() == tool_paint_button);
current_tile_data_editor_toolbar->set_visible(tools_button_group->get_pressed_button() == tool_paint_button);
current_tile_data_editor->get_toolbar()->set_visible(tools_button_group->get_pressed_button() == tool_paint_button);
}
}
@ -1031,6 +1030,10 @@ void TileSetAtlasSourceEditor::_update_atlas_view() {
void TileSetAtlasSourceEditor::_update_toolbar() {
// Show the tools and settings.
Control *current_tile_data_editor_toolbar = nullptr;
if (current_tile_data_editor) {
current_tile_data_editor_toolbar = current_tile_data_editor->get_toolbar();
}
if (tools_button_group->get_pressed_button() == tool_setup_atlas_source_button) {
if (current_tile_data_editor_toolbar) {
current_tile_data_editor_toolbar->hide();

View File

@ -142,7 +142,6 @@ private:
// -- Tile data editors --
String current_property;
Control *current_tile_data_editor_toolbar = nullptr;
HashMap<String, TileDataEditor *> tile_data_editors;
TileDataEditor *current_tile_data_editor = nullptr;
void _tile_data_editors_tree_selected();