summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Snopek <dsnopek@gmail.com>2023-10-25 15:13:22 -0500
committerGitHub <noreply@github.com>2023-10-25 15:13:22 -0500
commitc1196a1ab0a1ca166d0e5e2f08f9fe4156118c5e (patch)
treed91a1ff8d5ac84763887410a07e461ea63f0db2a
parentf79bd795d52d625e8055d4ab6c0c885d6b6674a4 (diff)
parent4b76485a4e44b56f5c985f8907b15f981c9a5419 (diff)
downloadredot-cpp-c1196a1ab0a1ca166d0e5e2f08f9fe4156118c5e.tar.gz
Merge pull request #1286 from dsnopek/callable-custom-object-id
Switch to using `ObjectID` in custom callables
-rw-r--r--gdextension/gdextension_interface.h4
-rw-r--r--src/variant/callable_method_pointer.cpp2
2 files changed, 3 insertions, 3 deletions
diff --git a/gdextension/gdextension_interface.h b/gdextension/gdextension_interface.h
index 240da6e..d58f022 100644
--- a/gdextension/gdextension_interface.h
+++ b/gdextension/gdextension_interface.h
@@ -392,7 +392,7 @@ typedef GDExtensionBool (*GDExtensionCallableCustomLessThan)(void *callable_user
typedef void (*GDExtensionCallableCustomToString)(void *callable_userdata, GDExtensionBool *r_is_valid, GDExtensionStringPtr r_out);
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
* `GDExtensionClassLibraryPtr` passed to the entry symbol function.
@@ -409,7 +409,7 @@ typedef struct {
void *callable_userdata;
void *token;
- GDExtensionObjectPtr object;
+ GDObjectInstanceID object_id;
GDExtensionCallableCustomCall call_func;
GDExtensionCallableCustomIsValid is_valid_func;
diff --git a/src/variant/callable_method_pointer.cpp b/src/variant/callable_method_pointer.cpp
index 7934c73..ea43632 100644
--- a/src/variant/callable_method_pointer.cpp
+++ b/src/variant/callable_method_pointer.cpp
@@ -52,7 +52,7 @@ Callable create_custom_callable(CallableCustomMethodPointerBase *p_callable_meth
GDExtensionCallableCustomInfo info = {};
info.callable_userdata = p_callable_method_pointer;
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.free_func = &free_custom_callable;