Skip to content

[WIP] Allow returning new java objects from JNI downcall #227

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ktoso
Copy link
Collaborator

@ktoso ktoso commented May 5, 2025

This isn't really a solution but just showcases the issue.

We cannot just return a newly created object without keeping the ref alive as we'll get a null on the java side otherwise.

The solution will be managing refs and checking if we escaped them or not proably...

ktoso added 3 commits May 5, 2025 13:06
We must reinvent how we promote values to global refs etc. Without the
promotion we get a null. We need to manage the retains automatically as
we return from a downcall in any wrapped java wrapper class etc...
@@ -38,6 +39,6 @@ public class JavaObjectHolder {
}

deinit {
self.forget()
// self.forget()
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixme, not real solution ofc.

@ktoso ktoso marked this pull request as draft May 5, 2025 04:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant