After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 679286 - [0.11] gst_element_get_bus() causes GObject asserts in py-gi
[0.11] gst_element_get_bus() causes GObject asserts in py-gi
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
0.11.x
Other Linux
: Normal normal
: 0.11.x
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2012-07-02 23:15 UTC by Tim-Philipp Müller
Modified: 2012-07-09 12:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
bus: don't return bus with floating ref from gst_element_get_bus() (1.91 KB, patch)
2012-07-02 23:15 UTC, Tim-Philipp Müller
rejected Details | Review

Description Tim-Philipp Müller 2012-07-02 23:15:11 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.
Comment 1 Tim-Philipp Müller 2012-07-09 12:19:07 UTC
"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 2 Tim-Philipp Müller 2012-07-09 12:20:07 UTC
Comment on attachment 217885 [details] [review]
bus: don't return bus with floating ref from gst_element_get_bus()

done it differently.