You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-22 15:06:45 +00:00
Fix GDNative compat breakage due to dangling Variants fix
This moves the instance id member from Variant to the ObjectRC so that Variant is still the same size as before the fix (and also regardless if debug or release build).
This commit is contained in:
@@ -1125,7 +1125,6 @@ void Variant::clear() {
|
||||
if (_get_obj().rc->decrement()) {
|
||||
memfree(_get_obj().rc);
|
||||
}
|
||||
_get_obj().instance_id = 0;
|
||||
} else {
|
||||
_get_obj().ref.unref();
|
||||
}
|
||||
@@ -1602,7 +1601,7 @@ String Variant::stringify(List<const void *> &stack) const {
|
||||
return obj->to_string();
|
||||
} else {
|
||||
#ifdef DEBUG_ENABLED
|
||||
if (ScriptDebugger::get_singleton() && _get_obj().instance_id != 0 && !ObjectDB::get_instance(_get_obj().instance_id)) {
|
||||
if (ScriptDebugger::get_singleton() && _get_obj().rc && !ObjectDB::get_instance(_get_obj().rc->instance_id)) {
|
||||
return "[Deleted Object]";
|
||||
}
|
||||
#endif
|
||||
@@ -1765,7 +1764,7 @@ Variant::operator RID() const {
|
||||
#ifdef DEBUG_ENABLED
|
||||
Object *obj = _get_obj().rc->get_ptr();
|
||||
if (unlikely(!obj)) {
|
||||
if (ScriptDebugger::get_singleton() && _get_obj().instance_id != 0 && !ObjectDB::get_instance(_get_obj().instance_id)) {
|
||||
if (ScriptDebugger::get_singleton() && _get_obj().rc && !ObjectDB::get_instance(_get_obj().rc->instance_id)) {
|
||||
WARN_PRINT("Attempted get RID on a deleted object.");
|
||||
}
|
||||
}
|
||||
@@ -2318,7 +2317,6 @@ Variant::Variant(const RefPtr &p_resource) {
|
||||
memnew_placement(_data._mem, ObjData);
|
||||
#ifdef DEBUG_ENABLED
|
||||
_get_obj().rc = NULL;
|
||||
_get_obj().instance_id = 0;
|
||||
#else
|
||||
REF *ref = reinterpret_cast<REF *>(p_resource.get_data());
|
||||
_get_obj().obj = ref->ptr();
|
||||
@@ -2339,7 +2337,6 @@ Variant::Variant(const Object *p_object) {
|
||||
memnew_placement(_data._mem, ObjData);
|
||||
#ifdef DEBUG_ENABLED
|
||||
_get_obj().rc = p_object ? const_cast<Object *>(p_object)->_use_rc() : NULL;
|
||||
_get_obj().instance_id = p_object ? p_object->get_instance_id() : 0;
|
||||
#else
|
||||
_get_obj().obj = const_cast<Object *>(p_object);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user