Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions core/reference.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ 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);
ClassDB::bind_method(D_METHOD("reset_ref"), &Reference::reset_ref);
}

int Reference::reference_get_count() const {
Expand Down Expand Up @@ -102,6 +103,12 @@ bool Reference::unreference() {
return die;
}

void Reference::reset_ref() {

refcount.init();
refcount_init.init();
}

Reference::Reference() {

refcount.init();
Expand Down
1 change: 1 addition & 0 deletions core/reference.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class Reference : public Object {
bool init_ref();
bool reference(); // returns false if refcount is at zero and didn't get increased
bool unreference();
void reset_ref();
int reference_get_count() const;

Reference();
Expand Down