GNOME Bugzilla – Bug 679286
[0.11] gst_element_get_bus() causes GObject asserts in py-gi
Last modified: 2012-07-09 12:20:07 UTC
Created attachment 217885 [details] [review] bus: don't return bus with floating ref from gst_element_get_bus() This little python code causes warnings and assertions on exit: ------------------------------------------------------------------------- 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; ------------------------------------------------------------------------- It looks like py-gi might be reacting badly to _get_bus() returning a GstBus that still has the floating flag set (since it is a GstObject and hence a GInitiallyUnowned). The attached patch seems to make it work fine for me, but I'm not sure how kosher it is.
"Fixed": commit c0c79188ca5d9f0a2d13ab3940a7e4977410cdca Author: Tim-Philipp Müller <tim@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
Comment on attachment 217885 [details] [review] bus: don't return bus with floating ref from gst_element_get_bus() done it differently.