Merge pull request #1286 from dsnopek/callable-custom-object-id

Switch to using `ObjectID` in custom callables
pull/1288/head
David Snopek 2023-10-25 15:13:22 -05:00 committed by GitHub
commit c1196a1ab0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -392,7 +392,7 @@ typedef GDExtensionBool (*GDExtensionCallableCustomLessThan)(void *callable_user
typedef void (*GDExtensionCallableCustomToString)(void *callable_userdata, GDExtensionBool *r_is_valid, GDExtensionStringPtr r_out); typedef void (*GDExtensionCallableCustomToString)(void *callable_userdata, GDExtensionBool *r_is_valid, GDExtensionStringPtr r_out);
typedef struct { typedef struct {
/* Only `call_func` and `token` are strictly required, however, `object` should be passed if its not a static method. /* Only `call_func` and `token` are strictly required, however, `object_id` should be passed if its not a static method.
* *
* `token` should point to an address that uniquely identifies the GDExtension (for example, the * `token` should point to an address that uniquely identifies the GDExtension (for example, the
* `GDExtensionClassLibraryPtr` passed to the entry symbol function. * `GDExtensionClassLibraryPtr` passed to the entry symbol function.
@ -409,7 +409,7 @@ typedef struct {
void *callable_userdata; void *callable_userdata;
void *token; void *token;
GDExtensionObjectPtr object; GDObjectInstanceID object_id;
GDExtensionCallableCustomCall call_func; GDExtensionCallableCustomCall call_func;
GDExtensionCallableCustomIsValid is_valid_func; GDExtensionCallableCustomIsValid is_valid_func;

View File

@ -52,7 +52,7 @@ Callable create_custom_callable(CallableCustomMethodPointerBase *p_callable_meth
GDExtensionCallableCustomInfo info = {}; GDExtensionCallableCustomInfo info = {};
info.callable_userdata = p_callable_method_pointer; info.callable_userdata = p_callable_method_pointer;
info.token = internal::token; info.token = internal::token;
info.object = object != nullptr ? object->_owner : nullptr; info.object_id = object ? object->get_instance_id() : 0;
info.call_func = &call_custom_callable; info.call_func = &call_custom_callable;
info.free_func = &free_custom_callable; info.free_func = &free_custom_callable;