godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.3k stars 21.24k forks source link

Autowraping Label within AspectRatioContainer causes crash #99520

Open onesuchkeeper opened 10 hours ago

onesuchkeeper commented 10 hours ago

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

onesuchkeeper commented 9 hours ago

Setting the Label's Horizontal Alignment or Vertical Alignment to Fill produces the expected behavior, where the aspect ratio is broken and the container is expanded to fit the label

AThousandShips commented 3 hours ago

Related: