MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / ref_pointer

Method ref_pointer

core/object/ref_counted.h:72–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70
71 template <bool Init>
72 _FORCE_INLINE_ void ref_pointer(T *p_refcounted) {
73 if (p_refcounted == reference) {
74 return;
75 }
76
77 // This will go out of scope and get unref'd.
78 Ref cleanup_ref;
79 cleanup_ref.reference = reference;
80 reference = p_refcounted;
81 if (reference) {
82 if constexpr (Init) {
83 if (!reference->init_ref()) {
84 reference = nullptr;
85 }
86 } else {
87 if (!reference->reference()) {
88 reference = nullptr;
89 }
90 }
91 }
92 }
93
94 //virtual RefCounted * get_reference() const { return reference; }
95public:

Callers

nothing calls this directly

Calls 2

init_refMethod · 0.80
referenceMethod · 0.45

Tested by

no test coverage detected