-
-
Notifications
You must be signed in to change notification settings - Fork 586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix crash using Object* as parameter #1044
Conversation
@@ -168,7 +168,9 @@ MAKE_PTRARG_BY_REFERENCE(Variant); | |||
template <class T> | |||
struct PtrToArg<T *> { | |||
_FORCE_INLINE_ static T *convert(const void *p_ptr) { | |||
return reinterpret_cast<T *>(godot::internal::gde_interface->object_get_instance_binding(*reinterpret_cast<GDExtensionObjectPtr *>(const_cast<void *>(p_ptr)), godot::internal::token, &T::___binding_callbacks)); | |||
auto gde_obj_ptr = reinterpret_cast<GDExtensionObjectPtr>(const_cast<void *>(p_ptr)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please state the type explicitly instead of using auto
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine, object_get_instance_binding
takes GDExtensionObjectPtr
which is Object *
. auto
is absolutely unnecessary, in this case it's always GDExtensionObjectPtr
.
Changed. Just wanted to avoid writing GDExtensionObjectPtr twice before and after reinterpret_cast. |
Looks good! Could you squash the commits? See PR workflow for instructions. |
41fedec
to
093f067
Compare
Done |
Thanks! |
This PR appears to have caused a regression similar to #1045 When debugging an issue someone found while testing godotengine/godot#77010, I found that Godot appears to be passing |
…standardize on `Object **` encoding in ptrcall
Fixes #1020, fixes #1025 (only for
Object*
parameter crash,Ref<Object>
crash reported recently is a different issue).*reinterpret_cast<GDExtensionObjectPtr *>
->reinterpret_cast<GDExtensionObjectPtr>
as the real type ofp_ptr
isObject*
notObject**
.