1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-07 12:30:27 +00:00

GDScript: Fix temp values being written without proper clear

Temporary values in the stack were not being properly cleared when the
return value of calls were discarded, which can cause memory issues
especially for reference types like PackedByteArray.
This commit is contained in:
George Marques
2023-01-11 14:24:23 -03:00
parent 2ac2db8de5
commit 66fda2aeea
4 changed files with 61 additions and 61 deletions

View File

@@ -0,0 +1,17 @@
# https://github.com/godotengine/godot/issues/71177
func test():
builtin_method()
builtin_method_static()
print("done")
func builtin_method():
var pba := PackedByteArray()
@warning_ignore(return_value_discarded)
pba.resize(1) # Built-in validated.
func builtin_method_static():
var _pba := PackedByteArray()
@warning_ignore(return_value_discarded)
Vector2.from_angle(PI) # Static built-in validated.

View File

@@ -0,0 +1,2 @@
GDTEST_OK
done