Variant
s pointer to object can unadvertedly become invalid
#35488
Labels
Milestone
Variant
s pointer to object can unadvertedly become invalid
#35488
Godot version:
All of them? (At least 3.1.x and 3.2.x.)
OS/device including version:
N/A
Issue description:
The problem is the way Godot manages the memory of non-
Resource
objects. Since they are not reference-counted, you can haveVariant
s with dangling pointers to freed ones. This is a big problem, because it affects scripting.In addition, if a newly created object happens to be at the same address of a freed one, any dangling pointer to the old one will be effectively pointing to the new one.
Steps to reproduce:
This simple code is able to demonstrate the problem:
Output:
As can be seen, the
TextureRect
has been allocated at the same address theMarginContainer
was.Minimal reproduction project:
Not needed.
The text was updated successfully, but these errors were encountered: