소스 검색

Merge pull request #33168 from nekomatata/weak-ref-leak

Fixed leak in gdscript when creating empty WeakRef
Rémi Verschelde 5 년 전
부모
커밋
99324d9fda
1개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  1. 2 1
      modules/gdscript/gdscript_functions.cpp

+ 2 - 1
modules/gdscript/gdscript_functions.cpp

@@ -589,7 +589,8 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_
 					r_ret = wref;
 				}
 			} else if (p_args[0]->get_type() == Variant::NIL) {
-				r_ret = memnew(WeakRef);
+				Ref<WeakRef> wref = memnew(WeakRef);
+				r_ret = wref;
 			} else {
 				r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
 				r_error.argument = 0;