godotengine / godotengine/godot
TileMapLayers are emitting `changed()` signal after get_tree().quit() is called.
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
v4.3.stable.arch_linux
### System information
Godot v4.3.stable unknown - Arch Linux #1 SMP PREEMPT_DYNAMIC Tue, 10 Sep 2024 14:37:32 +0000 - X11 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3090 (nvidia; 560.35.03) - AMD Ryzen 7 5800X 8-Core Processor (16 Threads)
### Issue description
When `get_tree().quit()` is called, `TileMapLayer` nodes emit their `changed()` signal after their `TileSet` has been removed from the scene tree. This means that code connected to the changed signal that tries to access properties on the `TileSet` will error for trying to access properties on a null value.
This behaviour is not present on TileMaps in previous versions of Godot (confirmed in 4.2).
### Steps to reproduce
1. Create a `TileMapLayer` with a `TileSet`.
2. Connect a script to the `TileMapLayer` `changed()` signal that accesses `tile_set.tile_size`
3. Call `get_tree().quit()` or close game via the OS close button on the window.
4. Game hangs due to trying to access `tile_set` on a null object.
### Minimal reproduction project (MRP)
See above steps.
I have shared a minimal reproduction project for triggering this issue while using PhantomCamera here: https://github.com/Jack-023/phantom-camera-error-repro
This was set up before determining that this is a Godot issue so it is not technically minimal in the context of Godot but it does demonstrate the issue.
Contributor guide
Research direction
No source file or test is named. First reproduce the shutdown sequence with a TileMapLayer, TileSet, and changed() callback using the listed steps or the linked minimal project; done means quitting no longer emits changed() after the TileSet has left the scene tree, without the callback encountering a null TileSet.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, godot
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 45/100