jwharm / java-gi

GObject-Introspection bindings generator for Java
GNU Lesser General Public License v2.1
93 stars 9 forks source link

Non-GObject return with transfer-ownership="none" should not be owned by the JVM #99

Closed BwackNinja closed 6 months ago

BwackNinja commented 6 months ago

If a method returns an object that isn't a GObject, it is currently owned by the JVM even when annotated with transfer-ownership="none" in the GIR file. An example of this is gst_caps_get_structure. This result in use-after-free errors since it is cleaned up unless a reference to it is retained. Relevant code is here: https://github.com/jwharm/java-gi/blob/development/buildSrc/src/main/java/io/github/jwharm/javagi/generators/MethodGenerator.java#L255

jwharm commented 6 months ago

Fixed in release 0.10.0