gstreamer-java / gst1-java-core

Java bindings for GStreamer 1.x
GNU Lesser General Public License v3.0
188 stars 72 forks source link

Ref counting issues with MiniObject copy #171

Closed neilcsmith-net closed 4 years ago

neilcsmith-net commented 5 years ago

As currently mapped the use of @CallerOwnsReturn on methods returning a GstMiniObject rather than a GObject may be incorrectly decrementing the refcount. MiniObject::copy is potentially one such concern. Noticed after calling Buffer::copy that the refcount is 0!

neilcsmith-net commented 4 years ago

Seems to be caused where we cache an initially unowned reference where something might be pooled (eg. Buffers). Then when a caller-owns-return reference is requested later we decrement the refcount when we shouldn't. We should keep the extra ref and mark as owned.