mirror of
https://github.com/godotengine/godot.git
synced 2024-11-22 12:12:28 +00:00
Fix crash when removing tabs from TabBar
This commit is contained in:
parent
d3a6b6daaa
commit
2b4d417e99
@ -524,13 +524,14 @@ void TabBar::set_tab_count(int p_count) {
|
||||
offset = MIN(offset, p_count - 1);
|
||||
max_drawn_tab = MIN(max_drawn_tab, p_count - 1);
|
||||
current = MIN(current, p_count - 1);
|
||||
|
||||
_update_cache();
|
||||
_ensure_no_over_offset();
|
||||
if (scroll_to_selected) {
|
||||
ensure_tab_visible(current);
|
||||
}
|
||||
}
|
||||
|
||||
_update_cache();
|
||||
_ensure_no_over_offset();
|
||||
if (scroll_to_selected) {
|
||||
ensure_tab_visible(current);
|
||||
}
|
||||
update();
|
||||
update_minimum_size();
|
||||
notify_property_list_changed();
|
||||
@ -961,7 +962,6 @@ void TabBar::clear_tabs() {
|
||||
current = 0;
|
||||
previous = 0;
|
||||
|
||||
_update_cache();
|
||||
update();
|
||||
update_minimum_size();
|
||||
notify_property_list_changed();
|
||||
@ -975,18 +975,21 @@ void TabBar::remove_tab(int p_idx) {
|
||||
}
|
||||
|
||||
if (current < 0) {
|
||||
offset = 0;
|
||||
max_drawn_tab = 0;
|
||||
current = 0;
|
||||
previous = 0;
|
||||
}
|
||||
if (current >= tabs.size()) {
|
||||
current = tabs.size() - 1;
|
||||
} else {
|
||||
offset = MIN(offset, tabs.size() - 1);
|
||||
max_drawn_tab = MIN(max_drawn_tab, tabs.size() - 1);
|
||||
|
||||
_update_cache();
|
||||
_ensure_no_over_offset();
|
||||
if (scroll_to_selected && !tabs.is_empty()) {
|
||||
ensure_tab_visible(current);
|
||||
}
|
||||
}
|
||||
|
||||
_update_cache();
|
||||
_ensure_no_over_offset();
|
||||
if (scroll_to_selected && !tabs.is_empty()) {
|
||||
ensure_tab_visible(current);
|
||||
}
|
||||
update();
|
||||
update_minimum_size();
|
||||
notify_property_list_changed();
|
||||
|
Loading…
Reference in New Issue
Block a user