Fix closing last tab leads to crash on exit
This commit is contained in:
parent
57382e10a7
commit
e0d47ddf08
|
@ -953,6 +953,7 @@ void LimboAIEditor::_tab_clicked(int p_tab) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void LimboAIEditor::_tab_closed(int p_tab) {
|
void LimboAIEditor::_tab_closed(int p_tab) {
|
||||||
|
ERR_FAIL_INDEX(p_tab, history.size());
|
||||||
history.remove_at(p_tab);
|
history.remove_at(p_tab);
|
||||||
idx_history = MIN(idx_history, history.size() - 1);
|
idx_history = MIN(idx_history, history.size() - 1);
|
||||||
if (idx_history < 0) {
|
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"));
|
tab_bar->add_tab(tab_name, LimboUtility::get_singleton()->get_task_icon("BehaviorTree"));
|
||||||
}
|
}
|
||||||
if (idx_history >= 0) {
|
if (idx_history >= 0) {
|
||||||
|
ERR_FAIL_INDEX(idx_history, history.size());
|
||||||
tab_bar->set_current_tab(idx_history);
|
tab_bar->set_current_tab(idx_history);
|
||||||
}
|
}
|
||||||
updating_tabs = false;
|
updating_tabs = false;
|
||||||
|
|
|
@ -213,7 +213,7 @@ void TaskTree::unload() {
|
||||||
last_selected->disconnect(LW_NAME(changed), on_task_changed);
|
last_selected->disconnect(LW_NAME(changed), on_task_changed);
|
||||||
}
|
}
|
||||||
|
|
||||||
bt->unreference();
|
bt.unref();
|
||||||
tree->clear();
|
tree->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue