Fix crash using Object* as parameter#1044
Conversation
| 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.
Please state the type explicitly instead of using auto.
bruvzg
left a comment
There was a problem hiding this comment.
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_ptrisObject*notObject**.