diff options
Diffstat (limited to 'core/reference.h')
-rw-r--r-- | core/reference.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/core/reference.h b/core/reference.h index 972fd500d0..f5794b0b67 100644 --- a/core/reference.h +++ b/core/reference.h @@ -59,21 +59,24 @@ class Ref { T *reference = nullptr; void ref(const Ref &p_from) { - if (p_from.reference == reference) + if (p_from.reference == reference) { return; + } unref(); reference = p_from.reference; - if (reference) + if (reference) { reference->reference(); + } } void ref_pointer(T *p_ref) { ERR_FAIL_COND(!p_ref); - if (p_ref->init_ref()) + if (p_ref->init_ref()) { reference = p_ref; + } } //virtual Reference * get_reference() const { return reference; } @@ -189,8 +192,9 @@ public: } Ref(T *p_reference) { - if (p_reference) + if (p_reference) { ref_pointer(p_reference); + } } Ref(const Variant &p_variant) { |