浏览代码

Fix GDScript leak avoidance

Modify usage of types so that the `Ref` created from `base_type.script_type` doesn't involve converting first to `Variant`, which will use the constructor for `Object *`, as if the argument wasn't a `Reference`, and therefore will convert back to null.
Pedro J. Estébanez 5 年之前
父节点
当前提交
4cab6452d9
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      modules/gdscript/gdscript_compiler.cpp

+ 1 - 1
modules/gdscript/gdscript_compiler.cpp

@@ -1875,7 +1875,7 @@ Error GDScriptCompiler::_parse_class_level(GDScript *p_script, const GDScriptPar
 			p_script->native = native;
 		} break;
 		case GDScriptDataType::GDSCRIPT: {
-			Ref<GDScript> base = Ref<GDScript>(base_type.script_type);
+			Ref<GDScript> base = Ref<Script>(base_type.script_type);
 			p_script->base = base;
 			p_script->_base = base.ptr();
 			p_script->member_indices = base->member_indices;