summaryrefslogtreecommitdiff
path: root/core/reference.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/reference.cpp')
-rw-r--r--core/reference.cpp11
1 files changed, 0 insertions, 11 deletions
diff --git a/core/reference.cpp b/core/reference.cpp
index 57b72dcaad..cc8a9854fb 100644
--- a/core/reference.cpp
+++ b/core/reference.cpp
@@ -33,22 +33,18 @@
#include "core/script_language.h"
bool Reference::init_ref() {
-
if (reference()) {
-
if (!is_referenced() && refcount_init.unref()) {
unreference(); // first referencing is already 1, so compensate for the ref above
}
return true;
} else {
-
return false;
}
}
void Reference::_bind_methods() {
-
ClassDB::bind_method(D_METHOD("init_ref"), &Reference::init_ref);
ClassDB::bind_method(D_METHOD("reference"), &Reference::reference);
ClassDB::bind_method(D_METHOD("unreference"), &Reference::unreference);
@@ -59,7 +55,6 @@ int Reference::reference_get_count() const {
}
bool Reference::reference() {
-
uint32_t rc_val = refcount.refval();
bool success = rc_val != 0;
@@ -80,7 +75,6 @@ bool Reference::reference() {
}
bool Reference::unreference() {
-
uint32_t rc_val = refcount.unrefval();
bool die = rc_val == 0;
@@ -104,13 +98,11 @@ bool Reference::unreference() {
Reference::Reference() :
Object(true) {
-
refcount.init();
refcount_init.init();
}
Variant WeakRef::get_ref() const {
-
if (ref.is_null())
return Variant();
@@ -119,7 +111,6 @@ Variant WeakRef::get_ref() const {
return Variant();
Reference *r = cast_to<Reference>(obj);
if (r) {
-
return REF(r);
}
@@ -131,11 +122,9 @@ void WeakRef::set_obj(Object *p_object) {
}
void WeakRef::set_ref(const REF &p_ref) {
-
ref = p_ref.is_valid() ? p_ref->get_instance_id() : ObjectID();
}
void WeakRef::_bind_methods() {
-
ClassDB::bind_method(D_METHOD("get_ref"), &WeakRef::get_ref);
}