Fix closing last tab leads to crash on exit

This commit is contained in:
Serhii Snitsaruk 2024-05-27 15:36:17 +02:00
parent 57382e10a7
commit e0d47ddf08
No known key found for this signature in database
GPG Key ID: A965EF8799FFEC2D
2 changed files with 3 additions and 1 deletions

View File

@ -953,6 +953,7 @@ void LimboAIEditor::_tab_clicked(int p_tab) {
}
void LimboAIEditor::_tab_closed(int p_tab) {
ERR_FAIL_INDEX(p_tab, history.size());
history.remove_at(p_tab);
idx_history = MIN(idx_history, history.size() - 1);
if (idx_history < 0) {
@ -979,6 +980,7 @@ void LimboAIEditor::_update_tabs() {
tab_bar->add_tab(tab_name, LimboUtility::get_singleton()->get_task_icon("BehaviorTree"));
}
if (idx_history >= 0) {
ERR_FAIL_INDEX(idx_history, history.size());
tab_bar->set_current_tab(idx_history);
}
updating_tabs = false;

View File

@ -213,7 +213,7 @@ void TaskTree::unload() {
last_selected->disconnect(LW_NAME(changed), on_task_changed);
}
bt->unreference();
bt.unref();
tree->clear();
}