Browse Source

Merge pull request #36532 from Faless/debugger/weakref_crash_vulkan

Fix debugger crash inspecting freed object.
Rémi Verschelde 5 years ago
parent
commit
dace1ec912
1 changed files with 9 additions and 5 deletions
  1. 9 5
      scene/debugger/scene_debugger.cpp

+ 9 - 5
scene/debugger/scene_debugger.cpp

@@ -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);