Fix debugger crash inspecting freed object.

This seems to be the correct way to validate a reference.
Why is cast_to failing? Is this the correct way of checking if the
object is valid?
This commit is contained in:
Fabio Alessandrelli 2020-02-25 15:00:52 +01:00
parent b8f0da7bed
commit d8ba07ea8f

View file

@ -347,13 +347,17 @@ void SceneDebuggerObject::serialize(Array &r_arr, int p_max_size) {
const PropertyInfo &pi = properties[i].first; const PropertyInfo &pi = properties[i].first;
Variant &var = properties[i].second; Variant &var = properties[i].second;
WeakRef *ref = Object::cast_to<WeakRef>(var);
if (ref) {
var = ref->get_ref();
}
RES res = var; RES res = var;
if (var.get_type() == Variant::OBJECT && var.is_ref()) {
REF r = var;
if (r.is_valid()) {
res = *r;
} else {
res = RES();
}
}
Array prop; Array prop;
prop.push_back(pi.name); prop.push_back(pi.name);
prop.push_back(pi.type); prop.push_back(pi.type);