From 5804308c579866ee3992a168913743261e34d221 Mon Sep 17 00:00:00 2001 From: Ruslan Mustakov Date: Fri, 28 Jul 2017 22:27:12 +0700 Subject: [PATCH] Fix passing Refs via ptrcall There was no constructor for Ref from const pointer, so compiler decided to construct Variant from pointer and then construct Ref from Variant which turned it into NULL, because the Variant had null ref field. --- core/reference.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/reference.h b/core/reference.h index 4e2d6c36c0..90f2791f4b 100644 --- a/core/reference.h +++ b/core/reference.h @@ -330,7 +330,7 @@ struct PtrToArg > { _FORCE_INLINE_ static Ref convert(const void *p_ptr) { - return Ref(reinterpret_cast(p_ptr)); + return Ref(const_cast(reinterpret_cast(p_ptr))); } _FORCE_INLINE_ static void encode(Ref p_val, const void *p_ptr) { @@ -355,7 +355,7 @@ struct PtrToArg { _FORCE_INLINE_ static RefPtr convert(const void *p_ptr) { - return Ref(reinterpret_cast(p_ptr)).get_ref_ptr(); + return Ref(const_cast(reinterpret_cast(p_ptr))).get_ref_ptr(); } _FORCE_INLINE_ static void encode(RefPtr p_val, const void *p_ptr) { @@ -370,7 +370,7 @@ struct PtrToArg { _FORCE_INLINE_ static RefPtr convert(const void *p_ptr) { - return Ref(reinterpret_cast(p_ptr)).get_ref_ptr(); + return Ref(const_cast(reinterpret_cast(p_ptr))).get_ref_ptr(); } };