godotengine / godotengine/godot

Godot Editor crashes when creating a pck file with a deleted .godot directory and adding fonts

Open
#98,219 1 comment 0 reactions 0 assignees View on GitHub
bug crash needs testing topic:export
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

- Reproducible in: 4.3.stable

### System information

Ubuntu 22.04.5 LTS - Godot Editor 4.3.stable

### Issue description

If fonts are added to the project, and the **pck** file is created using **Godot Editor**, with the **".godot"** directory removed before that, then sometimes the **pck** file creation occurs with an error and Godot Editor crashes:
```reimport: begin: (Re)Importing Assets steps: 22
reimport: step 0: DejaVuSerifCondensed.ttf
reimport: step 10: DejaVuSansMono-BoldOblique.ttf
reimport: step 14: DejaVuSansCondensed-BoldOblique.ttf
ERROR: Caller thread can't call this function in this node (/root). Use call_deferred() or call_thread_group() instead.
at: propagate_notification (scene/main/node.cpp:2422)

=================================================================
handle_crash: Program crashed with signal 11
```

Example of a test project new-game-project, to reproduce:
[new-game-project.zip](https://github.com/user-attachments/files/17390277/new-game-project.zip)

Example of a script for playback:
[editor_loop_bug.zip](https://github.com/user-attachments/files/17390291/editor_loop_bug.zip)

The script input is the path to the Godot Editor executable file and the path to the new-game-project:
```
editor_loop_bug.sh -e -d
```

The script performs a loop deleting the ".godot" directory and creating a pck file:
```
for i in {0..100000}; do
clear
rm -rf $RESOURCE_DIR/.godot
${GODOT_EDITOR_BIN} --headless --path ${RESOURCE_DIR} --export-pack ${EXPORT_TEMPLATE} ${PCK_FILE}
if [[ $? -ne 0 ]]; then
echo "step failed"
exit 1
fi
done
```

### Steps to reproduce

1) Unpack the archive with the test project:
[new-game-project.zip](https://github.com/user-attachments/files/17390277/new-game-project.zip)
into a convenient directory

2) Run the editor_loop_bug.sh script:
[editor_loop_bug.zip](https://github.com/user-attachments/files/17390291/editor_loop_bug.zip)
specifying the path to the Godot Editor executable file and the path to the new-game-project as input:
```
editor_loop_bug.sh -e -d
```

3) Monitor the output

At the Nth iteration, Godot Editor will crash.

On my machine, sometimes the crash lasts for one minute, and sometimes 10 minutes or more

### Minimal reproduction project (MRP)

Example of a test project new-game-project, to reproduce:
[new-game-project.zip](https://github.com/user-attachments/files/17390277/new-game-project.zip)

Example of a script for playback:
[editor_loop_bug.zip](https://github.com/user-attachments/files/17390291/editor_loop_bug.zip)
The script input is the path to the Godot Editor executable file and the path to the new-game-project:
```
editor_loop_bug.sh -e -d
```

Contributor guide

Open the contributing guide

Research direction

Start with the provided new-game-project.zip and editor_loop_bug.sh, running the headless --export-pack loop after deleting the .godot directory. Then inspect scene/main/node.cpp around propagate_notification at line 2422 and the reimport/export path. Done means repeated PCK creation with the added fonts completes without the thread error or an editor crash.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
game-dev, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.