fix same project opening mutliple times from project manager

This commit is contained in:
Priyansh Rathi 2022-03-04 23:48:40 +05:30
parent f356c8ac4b
commit d5b8a25195
No known key found for this signature in database
GPG key ID: 8AB1FB727C1DBA82

View file

@ -1057,6 +1057,8 @@ public:
}
};
bool project_opening_initiated;
ProjectList();
~ProjectList();
@ -1136,6 +1138,7 @@ ProjectList::ProjectList() {
add_child(_scroll_children);
_icon_load_index = 0;
project_opening_initiated = false;
}
ProjectList::~ProjectList() {
@ -1818,7 +1821,9 @@ void ProjectList::_panel_input(const Ref<InputEvent> &p_ev, Node *p_hb) {
emit_signal(SNAME(SIGNAL_SELECTION_CHANGED));
if (!mb->is_ctrl_pressed() && mb->is_double_click()) {
// Do not allow opening a project more than once using a single project manager instance.
// Opening the same project in several editor instances at once can lead to various issues.
if (!mb->is_ctrl_pressed() && mb->is_double_click() && !project_opening_initiated) {
emit_signal(SNAME(SIGNAL_PROJECT_ASK_OPEN));
}
}
@ -2140,6 +2145,8 @@ void ProjectManager::_open_selected_projects() {
ERR_FAIL_COND(err);
}
_project_list->project_opening_initiated = true;
_dim_window();
get_tree()->quit();
}