Skip to content

Commit 2b10e67

Browse files
Fix leaked object - Label (#648)
This fixes a warning of leaked instances.
1 parent b9685cb commit 2b10e67

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

gui/theming_override/test.gd

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ onready var label = $VBoxContainer/Label
99
onready var button = $VBoxContainer/Button
1010
onready var button2 = $VBoxContainer/Button2
1111
onready var reset_all_button = $VBoxContainer/ResetAllButton
12-
12+
# Save the label color so it can be reset.
13+
onready var default_label_color = label.get_color("font_color")
1314

1415
func _ready():
1516
# Focus the first button automatically for keyboard/controller-friendly navigation.
@@ -63,7 +64,4 @@ func _on_reset_all_button_pressed():
6364
button2.add_stylebox_override("hover", null)
6465
button2.add_stylebox_override("pressed", null)
6566

66-
# If you don't have any references to the previous color value,
67-
# you can instance a node at runtime to get this value.
68-
var default_label_color = Label.new().get_color("font_color")
6967
label.add_color_override("font_color", default_label_color)

0 commit comments

Comments
 (0)