godotengine / godotengine/godot
Connecting callable in tool script with persist flag and bound object will serialize bound object
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
- Reproducible in: v4.4.1.stable.mono.arch_linux
### System information
Godot v4.4.1.stable.mono unknown - EndeavourOS #1 SMP PREEMPT_DYNAMIC Tue, 29 Apr 2025 09:23:13 +0000 on X11 - X11 display driver, Multi-window, 2 monitors - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1650 (nvidia; 570.144) - Intel(R) Core(TM) i5-9300H CPU @ 2.40GHz (8 threads)
### Issue description
When instantiating scene it will recreate bound object as a completely new one. Now it will not only pass the wrong object, it will also leak memory, both in editor and in game.
After thinking about it, I get why it doesn't work, but a warning would be nice. Maybe don't serialize it at all if it detects bound object and push an error instead
### Steps to reproduce
Bind an object to callable and connect it to signal with CONNECT_PERSIST flag in tool script, object could be a node
### Minimal reproduction project (MRP)
You can open `.tscn` file and see that it serialized bound `Node`
[wrong_callable.zip](https://github.com/user-attachments/files/20529588/wrong_callable.zip)
Contributor guide
Assessment
This issue has not been assessed yet.