godotengine / godotengine/godot
Unsaved script gets reloaded when Godot recovers focus
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
- Reproducible in: 4.4.stable and 4.4.1.rc1 (both official builds).
### System information
Godot v4.4.1.rc1 - Pop!_OS 22.04 LTS on X11 - X11 display driver, Multi-window, 1 monitor - Vulkan (Forward+) - integrated AMD Radeon Vega 8 Graphics (RADV RAVEN) - AMD Ryzen 5 3500U with Radeon Vega Mobile Gfx (8 threads)
### Issue description
I converted a project from `4.2` (I think at some point it was converted to `4.3` as well) to `4.4.stable`, and now everytime I focus out of Godot and come back to it, it tries to detect changes and reloads everything, which in the case of unsaved scripts results in the script losing pending changes and funnily enough it expands everything in the script.
I nuked `.godot` folder to try and fix the issue but didn't work.
### Steps to reproduce
Edit `node.gd` script without saving, make Godot lose focus by alt-tabbing to another program, or opening your OS notifications, or however you see fit. Come back to Godot and watch it reload the script wiping pending changes.
### Minimal reproduction project (MRP)
[mrp.zip](https://github.com/user-attachments/files/19289445/mrp.zip)
Contributor guide
Research direction
Start with the attached mrp.zip and reproduce the issue by editing node.gd, alt-tabbing away, and returning to Godot. Trace the editor's focus-recovery and change-detection behavior; done means unsaved script edits remain intact after focus is restored without an unnecessary reload.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- desktop, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100