godotengine / godotengine/godot

free.call_deferred() fails only in template_release

Open
#102,710 4 comments 1 reaction 0 assignees View on GitHub
bug topic:gdscript
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

Reproducible in 4.3.stable

### System information

Godot v4.3.stable - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3070 (NVIDIA; 32.0.15.6094) - AMD Ryzen 9 5900X 12-Core Processor (24 Threads)

### Issue description

When using free.call_deferred() there will be no error or warning in the editor nor if you play it after exporting it with “export with debug”. But if you export it with template_release it fails when playing with (node specifics omitted):

`SCRIPT ERROR: Parse Error: Identifier "free" not declared in the current scope. ERROR: Failed to load script with error "Parse error". at: load (modules/gdscript/gdscript.cpp:3022)`

The game will then refuse to use anything in the script so if anything relies on the faulty script it too will fail, meaning that the entire game fails.

Using call_deffered(“free”) and queue_free() works as intended, and in debug builds free.call_deferred() also works as intended

### Steps to reproduce

Write free.call_deferred() in _ready() of your main scene and export it with template_release

### Minimal reproduction project (MRP)

[template_release_fail.zip](https://github.com/user-attachments/files/18751060/template_release_fail.zip)

Contributor guide

Open the contributing guide

Research direction

Inspect modules/gdscript/gdscript.cpp:3022, starting with script loading for the template_release export, and compare it with debug export behavior. Use the attached template_release_fail.zip and the _ready() reproduction; done means free.call_deferred() parses and runs in template_release without breaking dependent scripts.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.