Merge pull request #46544 from Chaosus/tilemap_signal_fix

Check before connecting `TileMapEditor::settings_changed`
This commit is contained in:
Rémi Verschelde 2021-03-01 11:59:11 +01:00 committed by GitHub
commit c2799893f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 4 deletions

View File

@ -40,9 +40,12 @@
void TileMapEditor::_node_removed(Node *p_node) {
if (p_node == node && node) {
// Fixes #44824, which describes a situation where you can reselect a TileMap node without first de-selecting it when switching scenes.
node->disconnect("settings_changed", callable_mp(this, &TileMapEditor::_tileset_settings_changed));
Callable callable_tileset_settings_changed = callable_mp(this, &TileMapEditor::_tileset_settings_changed);
if (node->is_connected("settings_changed", callable_tileset_settings_changed)) {
// Fixes #44824, which describes a situation where you can reselect a TileMap node without first de-selecting it when switching scenes.
node->disconnect("settings_changed", callable_tileset_settings_changed);
}
node = nullptr;
}
}
@ -1870,7 +1873,11 @@ void TileMapEditor::edit(Node *p_tile_map) {
}
if (node) {
node->disconnect("settings_changed", callable_mp(this, &TileMapEditor::_tileset_settings_changed));
Callable callable_tileset_settings_changed = callable_mp(this, &TileMapEditor::_tileset_settings_changed);
if (node->is_connected("settings_changed", callable_tileset_settings_changed)) {
node->disconnect("settings_changed", callable_tileset_settings_changed);
}
}
if (p_tile_map) {
node = Object::cast_to<TileMap>(p_tile_map);
@ -1897,7 +1904,11 @@ void TileMapEditor::edit(Node *p_tile_map) {
}
if (node) {
node->connect("settings_changed", callable_mp(this, &TileMapEditor::_tileset_settings_changed));
Callable callable_tileset_settings_changed = callable_mp(this, &TileMapEditor::_tileset_settings_changed);
if (!node->is_connected("settings_changed", callable_tileset_settings_changed)) {
node->connect("settings_changed", callable_tileset_settings_changed);
}
}
_clear_bucket_cache();