summaryrefslogtreecommitdiff
path: root/core/object
diff options
context:
space:
mode:
authorBastiaan Olij <mux213@gmail.com>2022-12-11 21:31:01 +1100
committerBastiaan Olij <mux213@gmail.com>2022-12-13 10:54:29 +1100
commit7502e1dc0da15334f88911a802fa6ba919b6c83c (patch)
tree70baddc21aa56a0e082a44e3ce759615f9d26df1 /core/object
parentba4bd7f00971a94c20d90e7d2c665d5eb0ae1b90 (diff)
Improve logic around using Ref<T> with GDExtension virtual functions
Diffstat (limited to 'core/object')
-rw-r--r--core/object/ref_counted.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/core/object/ref_counted.h b/core/object/ref_counted.h
index 71790fb825..411c589739 100644
--- a/core/object/ref_counted.h
+++ b/core/object/ref_counted.h
@@ -253,12 +253,14 @@ public:
template <class T>
struct PtrToArg<Ref<T>> {
_FORCE_INLINE_ static Ref<T> convert(const void *p_ptr) {
+ // p_ptr points to a RefCounted object
return Ref<T>(const_cast<T *>(reinterpret_cast<const T *>(p_ptr)));
}
typedef Ref<T> EncodeT;
_FORCE_INLINE_ static void encode(Ref<T> p_val, const void *p_ptr) {
+ // p_ptr points to an EncodeT object which is a Ref<T> object.
*(const_cast<Ref<RefCounted> *>(reinterpret_cast<const Ref<RefCounted> *>(p_ptr))) = p_val;
}
};
@@ -268,6 +270,7 @@ struct PtrToArg<const Ref<T> &> {
typedef Ref<T> EncodeT;
_FORCE_INLINE_ static Ref<T> convert(const void *p_ptr) {
+ // p_ptr points to a RefCounted object
return Ref<T>((T *)p_ptr);
}
};