소스 검색

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?
Fabio Alessandrelli 5 년 전
부모
커밋
d8ba07ea8f
1개의 변경된 파일9개의 추가작업 그리고 5개의 파일을 삭제
  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;
 		Variant &var = properties[i].second;
 
-		WeakRef *ref = Object::cast_to<WeakRef>(var);
-		if (ref) {
-			var = ref->get_ref();
-		}
-
 		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;
 		prop.push_back(pi.name);
 		prop.push_back(pi.type);