diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2020-02-15 15:30:46 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-15 15:30:46 +0100 |
commit | 264f20f8c1b326546494b10f485ff8bc7464b253 (patch) | |
tree | 3a0fa22ce848b4ee20df2057ebb5eb5d7ea8e89b /core/variant_call.cpp | |
parent | 53cf289f309ef44821e5bb1fe0c81de29a82d9d3 (diff) | |
parent | 867d073b98344b848c96012418912a7e72841a31 (diff) |
Merge pull request #36189 from reduz/object-id-refactor
Changed logic and optimized ObjectID in ObjectDB and Variant, removed…
Diffstat (limited to 'core/variant_call.cpp')
-rw-r--r-- | core/variant_call.cpp | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/core/variant_call.cpp b/core/variant_call.cpp index f088705cdd..ac995d1c78 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -1099,12 +1099,9 @@ void Variant::call_ptr(const StringName &p_method, const Variant **p_args, int p return; } #ifdef DEBUG_ENABLED - if (ScriptDebugger::get_singleton() && _get_obj().ref.is_null()) { - //only if debugging! - if (!ObjectDB::instance_validate(obj)) { - r_error.error = CallError::CALL_ERROR_INSTANCE_IS_NULL; - return; - } + if (ScriptDebugger::get_singleton() && !_get_obj().id.is_reference() && ObjectDB::get_instance(_get_obj().id) == nullptr) { + r_error.error = CallError::CALL_ERROR_INSTANCE_IS_NULL; + return; } #endif @@ -1274,18 +1271,11 @@ Variant Variant::construct(const Variant::Type p_type, const Variant **p_args, i bool Variant::has_method(const StringName &p_method) const { if (type == OBJECT) { - Object *obj = operator Object *(); + Object *obj = get_validated_object(); if (!obj) return false; -#ifdef DEBUG_ENABLED - if (ScriptDebugger::get_singleton()) { - if (ObjectDB::instance_validate(obj)) { -#endif - return obj->has_method(p_method); -#ifdef DEBUG_ENABLED - } - } -#endif + + return obj->has_method(p_method); } const _VariantCall::TypeFunc &tf = _VariantCall::type_funcs[type]; |