godotengine / godotengine/godot

Autowraping Label within AspectRatioContainer causes crash

Open
#99,520 3 comments 1 reaction 0 assignees View on GitHub
bug crash topic:gui
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

Godot_v4.3-stable_mono_win64

### System information

Godot v4.3.stable.mono - Windows 10.0.19045 - GLES3 (Compatibility) - NVIDIA GeForce RTX 3070 (NVIDIA; 32.0.15.6081) - Intel(R) Core(TM) i7-10700K CPU @ 3.80GHz (16 Threads)

### Issue description

A Label with Autowrap inside an AspectRatioContainer too small to fit it will crash not only a project but the Godot editor itself.

If you're experiencing this issue and it hasn't ben resolved yet, setting the Text Overrun Behavior of the label to anything other than "Trim Nothing" will prevent the crash. This is not a full workaround though, as it forces the label to shrink to it's minimum size when in a container with other controls, which may not be your desired behavior.

### Steps to reproduce

1. Create a new project
2. Create a new scene with root node of type AspectRatioContainer and set its anchor preset to full rect
3. Nest a Label node inside the AspectRatioContainer node
4. Set the Label's Custom Minimum Size to (32,32)
5. Set the Label's Autowrap Mode to Arbitrary (also occurs on Word and Word (Smart))
6. Set the Label's 'Text' property to a string long enough such that it overflows the bounds of the container

-Expected Result-
The label expands the bounds of the container to accomidate, similarly to how a label with Autowrap off will expand the container.

-Result-
The Godot editor stops responding and crashes

### Minimal reproduction project (MRP)

[aspectratiocontainerissue.zip](https://github.com/user-attachments/files/17856666/aspectratiocontainerissue.zip)

Contributor guide

Open the contributing guide

Research direction

Start with the linked minimal reproduction project and follow the listed steps in Godot 4.3 to reproduce the editor crash. Investigate the interaction between an autowrapped Label, its minimum size, and AspectRatioContainer sizing; done means the reproduction no longer crashes and the label/container behavior matches the expected result.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, godot
Domain
frontend, game-dev
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.