Skip to content
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

Segfault/NullPointerException using PythonJavaClass as proxy between Java and Python #332

Closed
kviktor opened this issue Feb 27, 2018 · 3 comments
Labels

Comments

@kviktor
Copy link

kviktor commented Feb 27, 2018

I created a class that implements one method of a built-in Java interface using PythonJavaClass. My class' constructor takes a function as the first argument and when the method I implemented is called it calls that function. After I initialize the class I simply pass it to my Activity instance and when I receive certain broadcasts I call the implemented method from Java to do the "callback" to Python.

Using this method up to now these 3 things have happened

  • the Activity segfaults
  • the call throws a NullPointerException (I implemented a method that returns a boolean and the exception is about "cannot unbox null value to boolean" or something similar)
  • things work flawlessly

One workaround I found was moving around the Python part of the code where I pass my class' instance to the Activity to different methods/functions. This fixed the issue however sometimes it creates DRY violations.

Has anyone experienced anything similar and came up with a more elegant solution?

@drmoose
Copy link
Contributor

drmoose commented Apr 13, 2018

Does your PythonJavaClass subclass reliably call super().__init__? Because if not, the segfaulting could be #301, which is addressed by PR #299.

@kviktor
Copy link
Author

kviktor commented Apr 14, 2018

I used that PR for my pyjnius build so I think it calls the init.

@github-actions
Copy link

👋 We use the issue tracker exclusively for bug reports and feature requests. However, this issue appears to be a support request. Please use our support channels to get help with the project.
Let us know if this comment was made in error, and we'll be happy to reopen the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants