Browse Source

Merge pull request #96900 from bruvzg/fd_startup

Fix native file dialog showing on loading project in editor.
Rémi Verschelde 11 months ago
parent
commit
6b9f4418bb
1 changed files with 2 additions and 1 deletions
  1. 2 1
      scene/gui/file_dialog.cpp

+ 2 - 1
scene/gui/file_dialog.cpp

@@ -76,6 +76,7 @@ void FileDialog::popup(const Rect2i &p_rect) {
 #ifdef TOOLS_ENABLED
 #ifdef TOOLS_ENABLED
 	if (is_part_of_edited_scene()) {
 	if (is_part_of_edited_scene()) {
 		ConfirmationDialog::popup(p_rect);
 		ConfirmationDialog::popup(p_rect);
+		return;
 	}
 	}
 #endif
 #endif
 
 
@@ -1380,7 +1381,7 @@ void FileDialog::set_use_native_dialog(bool p_native) {
 #endif
 #endif
 
 
 	// Replace the built-in dialog with the native one if it's currently visible.
 	// Replace the built-in dialog with the native one if it's currently visible.
-	if (is_visible() && DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_NATIVE_DIALOG_FILE) && (use_native_dialog || OS::get_singleton()->is_sandboxed())) {
+	if (is_inside_tree() && is_visible() && DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_NATIVE_DIALOG_FILE) && (use_native_dialog || OS::get_singleton()->is_sandboxed())) {
 		ConfirmationDialog::set_visible(false);
 		ConfirmationDialog::set_visible(false);
 		_native_popup();
 		_native_popup();
 	}
 	}