Godot Engine – Multi-platform 2D and 3D game engine
Variant destructor/clear skip zeroing Object*
aurpinebcbfec6cfc5b
diff --git a/core/variant/variant.cpp b/core/variant/variant.cppindex b3a6185c33b..029221cdb26 100644--- a/core/variant/variant.cpp+++ b/core/variant/variant.cpp@@ -1443,7 +1443,11 @@ void Variant::_clear_internal() {reinterpret_cast<NodePath *>(_data._mem)->~NodePath();} break;case OBJECT: {- _get_obj().unref();+ // Mirrors ObjData::unref+ const ObjData &objdata = _get_obj();+ if (objdata.id.is_ref_counted() && static_cast<RefCounted *>(objdata.obj)->unreference()) {+ memdelete(objdata.obj);+ }} break;case RID: {// Not much need probably.