Attempt to standardize Object ptrcall encoding on Object **

This commit is contained in:
David Snopek
2023-05-23 15:14:01 -05:00
parent 2eec9a67d5
commit 77733faede
4 changed files with 18 additions and 6 deletions

View File

@@ -242,8 +242,11 @@ public:
template <class T>
struct PtrToArg<Ref<T>> {
_FORCE_INLINE_ static Ref<T> convert(const void *p_ptr) {
if (p_ptr == nullptr) {
return Ref<T>();
}
// p_ptr points to a RefCounted object
return Ref<T>(const_cast<T *>(reinterpret_cast<const T *>(p_ptr)));
return Ref<T>(const_cast<T *>(*reinterpret_cast<T *const *>(p_ptr)));
}
typedef Ref<T> EncodeT;
@@ -259,8 +262,11 @@ struct PtrToArg<const Ref<T> &> {
typedef Ref<T> EncodeT;
_FORCE_INLINE_ static Ref<T> convert(const void *p_ptr) {
if (p_ptr == nullptr) {
return Ref<T>();
}
// p_ptr points to a RefCounted object
return Ref<T>((T *)p_ptr);
return Ref<T>(*((T *const *)p_ptr));
}
};