Skip to content

Add Ref<T> binding support. - #631

Merged
akien-mga merged 2 commits into
godotengine:masterfrom
Faless:ext/ref_casting_2
Sep 28, 2021
Merged

akien-mga merged 2 commits into
godotengine:masterfrom
Faless:ext/ref_casting_2

Conversation

@Faless

@Faless Faless commented Sep 28, 2021

Copy link
Copy Markdown
Contributor

Added PtrToArg and GetTypeInfo adapted from Godot.

Also adds a test for it.

Note: Returning references from godot-cpp seem to always require an extra referencing. My guess it that when returning it to godot it gets passed as an object, and that Godot does not create it's internal Ref in time. The instance seem to be destroyed when expected with the extra reference() before return.

Fixes #628 .

Added PtrToArg and GetTypeInfo adapted from Godot.
@Faless Faless added bug This has been identified as a bug discussion topic:gdextension This relates to the new Godot 4 extension implementation labels Sep 28, 2021
@Faless Faless added this to the 4.0 milestone Sep 28, 2021
@akien-mga
akien-mga merged commit 6a720e5 into godotengine:master Sep 28, 2021
@akien-mga

Copy link
Copy Markdown
Member

Thanks!

@akien-mga

Copy link
Copy Markdown
Member

Note: Returning references from godot-cpp seem to always require an extra referencing. My guess it that when returning it to godot it gets passed as an object, and that Godot does not create it's internal Ref in time. The instance seem to be destroyed when expected with the extra reference() before return.

I suggest opening an issue to keep track of it.

Might also be relevant: godotengine/godot#53135

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug This has been identified as a bug discussion topic:gdextension This relates to the new Godot 4 extension implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't bind methods using Ref<T> as return type or argument

2 participants