fix same project opening mutliple times from project manager

This commit is contained in:
Priyansh Rathi 2022-03-04 23:48:40 +05:30 committed by Relintai
parent 26dedeab0b
commit a834816352

View File

@ -1033,6 +1033,8 @@ public:
} }
}; };
bool project_opening_initiated;
ProjectList(); ProjectList();
~ProjectList(); ~ProjectList();
@ -1110,6 +1112,7 @@ ProjectList::ProjectList() {
add_child(_scroll_children); add_child(_scroll_children);
_icon_load_index = 0; _icon_load_index = 0;
project_opening_initiated = false;
} }
ProjectList::~ProjectList() { ProjectList::~ProjectList() {
@ -1718,7 +1721,9 @@ void ProjectList::_panel_input(const Ref<InputEvent> &p_ev, Node *p_hb) {
emit_signal(SIGNAL_SELECTION_CHANGED); emit_signal(SIGNAL_SELECTION_CHANGED);
if (!mb->get_control() && mb->is_doubleclick()) { // 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->get_control() && mb->is_doubleclick() && !project_opening_initiated) {
emit_signal(SIGNAL_PROJECT_ASK_OPEN); emit_signal(SIGNAL_PROJECT_ASK_OPEN);
} }
} }
@ -2031,6 +2036,8 @@ void ProjectManager::_open_selected_projects() {
ERR_FAIL_COND(err); ERR_FAIL_COND(err);
} }
_project_list->project_opening_initiated = true;
_dim_window(); _dim_window();
get_tree()->quit(); get_tree()->quit();
} }