You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When performing a Variant assignment where both refer to the same underlying memory, the variable will become <null> because the underlying godot-cpp Variant::operator= method blindly calls clear().
However, if we compare this to the engine's Variant::operator= method:
if (unlikely(this == &p_variant)) {
return;
}
The engine guards against corner cases, so that the memory is not corrupted.
When building code, such as scripting languages where you are working with arrays of variants for stack parameters, it's very likely to hit this use case where a user may write i = i in their code, where i variable refers to some random Variant allocated on the function/script execution stack.
Activity
Merge pull request #1960 from Naros/GH-1959