[Bug 743062] GstObject subclasses sinking instances in instance_init/constructor cause leaks in bindings
GStreamer (GNOME Bugzilla)
bugzilla at gnome.org
Mon May 15 11:59:23 UTC 2017
https://bugzilla.gnome.org/show_bug.cgi?id=743062
--- Comment #16 from Sebastian Dröge (slomo) <slomo at coaxion.net> ---
These ref_sink() were all added because bindings people asked for it btw,
relevant commit is:
commit c0c79188ca5d9f0a2d13ab3940a7e4977410cdca
Author: Tim-Philipp Müller <tim at centricular.net>
Date: Tue Jul 3 00:07:11 2012 +0100
bus, clock: make sure these never have a floating ref
Clear the initial floating ref in the init function for
busses and clocks. These objects can be set on multiple
elements, so there's no clear parent-child relationship
here. Ideally we'd just not make them derive from
GInitiallyUnowned at all, but since we want to keep
using GstObject features for debugging, we'll just do
it like this.
This should also fix some problems with bindings, which
seem to get confused when they get floating refs from
non-constructor functions (or functions annotated to
have a 'transfer full' return type). This works now:
from gi.repository import GObject, Gst
GObject.threads_init()
Gst.init(None)
pipeline=Gst.Pipeline()
bus = pipeline.get_bus()
pipeline.set_state(Gst.State.NULL)
del pipeline;
https://bugzilla.gnome.org/show_bug.cgi?id=679286
https://bugzilla.gnome.org/show_bug.cgi?id=657202
Which is also still correct: Whenever a floating reference appears in bindings,
they have no way of knowing whether it's theirs or not. And so they currently
assume that every floating reference that appears is theirs when seen in a
(transfer none)/(transfer floating) context and ref_sink() it. With (transfer
full) the problem is first out of the way, but delayed further down the line
until it appears in a situation where a new reference has to be retrieved
(ref_sink() again).
The only solutions other than this here now are for the long-term:
1) Get rid of floating references completely (yes please!)
2) Add transfer annotations for all the different variants of how you can get a
floating reference to GI. And break all users (bindings, code generators, etc)
of GI while at it.
--
You are receiving this mail because:
You are the QA Contact for the bug.
More information about the gstreamer-bugs
mailing list