Skip to content

Commit ba8be1b

Browse files
committed
Fix create & free instance callbacks in gdextension cython preprocessor
1 parent 1c202de commit ba8be1b

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

β€Žscripts/gdextension_cython_preprocessor.pyβ€Ž

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,13 @@ def __godot_extension_unregister_class():
8282
{ spec.class_name + "." + spec.unregister_class_hook + "()" if spec.unregister_class_hook is not None else "" }
8383
8484
@staticmethod
85-
cdef GDExtensionClassInstancePtr __godot_extension_create_instance(void* p_userdata) noexcept with gil:
85+
cdef GDExtensionObjectPtr __godot_extension_create_instance(void* p_class_userdata) noexcept with gil:
8686
cdef {spec.class_name} obj = {spec.class_name}()
8787
Py_INCREF(obj)
88-
return <PyObject*>obj
88+
return obj._gd_ptr
8989
9090
@staticmethod
91-
cdef void __godot_extension_free_instance(void* p_userdata, GDExtensionClassInstancePtr p_instance) noexcept with gil:
91+
cdef void __godot_extension_free_instance(void* p_class_userdata, GDExtensionClassInstancePtr p_instance) noexcept with gil:
9292
Py_DECREF(<{spec.class_name}>p_instance)
9393
9494
@staticmethod

β€Žsrc/_pythonscript_extension_class_script.pxiβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
cdef gd_string_name_t gdname_scriptextension
22
cdef gd_string_name_t gdname_pythonscript
33

4+
45
# godot_extension: class(parent="ScriptExtension")
56
@cython.final
67
cdef class PythonScript:

0 commit comments

Comments
Β (0)