Repository: godotengine/godot (language: cpp)

Issue:
Saving a previously invalid compute shader from an external editor crashes the Godot editor
### Tested versions

- Reproducible in: v4.4.beta2.official.a013481b0
- Not reproducible in: v4.3.stable.official.77dcf97d8

### System information

Godot v4.4.beta2 - Windows 11 (build 26100) - Multi-window, 2 monitors - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 4060 (NVIDIA; 32.0.15.6636) - AMD Ryzen 5 5600X 6-Core Processor (12 threads)

### Issue description

Saving a `.glsl` file containing a compute shader in an external editor after said compute shader failed to compile once results in a crash of the Godot editor.

The following error appears in the console:

```
Godot Engine v4.4.beta2.official.a013481b0 - https://godotengine.org
OpenGL API 3.3.0 NVIDIA 566.36 - Compatibility - Using Device: NVIDIA - NVIDIA GeForce RTX 4060

Editing project: [...]/test-cellular-automaton
Godot Engine v4.4.beta2.official.a013481b0 - https://godotengine.org
Vulkan 1.3.289 - Forward+ - Using Device #0: NVIDIA - NVIDIA GeForce RTX 4060

ERROR: Parameter "p_parent" is null.
   at: reparent (scene/main/node.cpp:1958)

================================================================
CrashHandlerException: Program crashed with signal 11
Engine version: Godot Engine v4.4.beta2.official (a013481b0911e59cc3f3dea7ebb732450c3e1460)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
```

Here is the compute shader I use:

```glsl
#[compute]
#version 450

// Invocations in the (x, y, z) dimension
layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in;

layout(set = 0, binding = 0, std140) uniform Parameters {
    vec4 p; // p.x -> height
}
parameters;

// Input buffer
layout(set = 0, binding = 1, std430) restrict readonly buffer Previous {
    int data[];
}
previous;

// Output buffer
layout(set = 0, binding = 2, std430) restrict writeonly buffer Next {
    int data[];
}
next;

// The code we want to execute in each invocation
void main() {
    uint idx = gl_GlobalInvocationID.x * uint(parameters.p.x) + gl_GlobalInvocationID.y;
    next.data[idx] *= previous.data[idx];
}

```

### Steps to reproduce

Starting from an new empty project.

- Open the Godot project folder in an external editor (VS Code).
- Add a new `test.glsl` compute shader with probably any content. Mine is provided below.
- Save, go in godot, it is correctly imported.
- Make a valid modification, save, go to Godot, it is re-imported and everything works fine.
- Go back to the external editor and make an **invalid** modification resulting in a failed compilation.
- Go back to Godot, you are notified of the issue with your shader.
- Now go back to the external editor and do any modification (valid or not) and save. Going back to Godot, the editor will simply crash.


### Minimal reproduction project (MRP)

[test-cellular-automaton-4.4.zip](https://github.com/user-attachments/files/18607934/test-cellular-automaton-4.4.zip)


Discussion / hints:
I can reproduce this. Here is a backtrace (on 9ee1873):
```
Thread 1 "godot.linuxbsd." received signal SIGSEGV, Segmentation fault.
Viewport::is_input_disabled (this=this@entry=0x0) at scene/main/viewport.cpp:3417
3417		return disable_input;

 0 in Viewport::is_input_disabled of scene/main/viewport.cpp:3417
 1 in ProgressDialog::_popup of editor/progress_dialog.cpp:173
 2 in ProgressDialog::add_task of editor/progress_dialog.cpp:208
 3 in EditorProgress::EditorProgress of editor/editor_node.cpp:191
 4 in EditorFileSystem::reimport_files of editor/editor_file_system.cpp:3073
 5 in EditorFileSystem::_update_scan_actions of editor/editor_file_system.cpp:962
 6 in EditorFileSystem::_notification of editor/editor_file_system.cpp:1691
 7 in Object::notification of core/object/object.cpp:911
 8 in SceneTree::_process_group of scene/main/scene_tree.cpp:1060
 9 in SceneTree::_process of scene/main/scene_tree.cpp:1137
10 in SceneTree::process of scene/main/scene_tree.cpp:578
11 in Main::iteration of main/main.cpp:4473
12 in OS_LinuxBSD::run of platform/linuxbsd/os_linuxbsd.cpp:962
13 in main of platform/linuxbsd/godot_linuxbsd.cpp:85
```
Also, I noticed that the `ProgressDialog` is not inside the tree when `_popup()` is called. So `get_last_exclusive_window()` returns nullptr.
Seems a regression between 4.4 beta 1 and 4.4 beta 2, i'll bisect.
Bisected to #101933, @KoBeWi 

![Image](https://github.com/user-attachments/assets/51762719-9eb4-4580-a408-edafaa943a2d)

------------------------------------

Using part of the old code as fallback seems to fix the issue:

![Image](https://github.com/user-attachments/assets/b58d3da3-c005-42f8-a67e-e9d8b7abb5f3)

But im not sure if this is the correct approach so i'll let Kobewi take a look on this first.

Fix patch:
diff --git a/editor/progress_dialog.cpp b/editor/progress_dialog.cpp
index dae7578a4eb9..2f551a4e57b9 100644
--- a/editor/progress_dialog.cpp
+++ b/editor/progress_dialog.cpp
@@ -166,7 +166,8 @@ void ProgressDialog::_popup() {
 
 	center_panel->set_custom_minimum_size(ms);
 
-	Window *current_window = get_last_exclusive_window();
+	Window *current_window = SceneTree::get_singleton()->get_root()->get_last_exclusive_window();
+	ERR_FAIL_NULL(current_window);
 	reparent(current_window);
 
 	// Ensures that events are properly released before the dialog blocks input.


Test patch: